class Example
include Familia field :name include Familia::Stamps
end
# File lib/familia/helpers.rb, line 11 def self.included(obj) obj.module_eval do field :created => Integer field :updated => Integer def init_stamps now = Time.now.utc.to_i @created ||= now @updated ||= now end def created @created ||= Time.now.utc.to_i end def updated @updated ||= Time.now.utc.to_i end def created_age Time.now.utc.to_i-created end def updated_age Time.now.utc.to_i-updated end def update_time @updated = Time.now.utc.to_i end def update_time! update_time save if respond_to? :save @updated end end end
# File lib/familia/helpers.rb, line 20 def created @created ||= Time.now.utc.to_i end
# File lib/familia/helpers.rb, line 26 def created_age Time.now.utc.to_i-created end
# File lib/familia/helpers.rb, line 15 def init_stamps now = Time.now.utc.to_i @created ||= now @updated ||= now end
# File lib/familia/helpers.rb, line 32 def update_time @updated = Time.now.utc.to_i end
# File lib/familia/helpers.rb, line 35 def update_time! update_time save if respond_to? :save @updated end
Generated with the Darkfish Rdoc Generator 2.