Module: Mongoid::Timestamps::Timeless::ClassMethods
- Defined in:
- lib/mongoid/timestamps/timeless.rb
Instance Method Summary collapse
- #clear_timeless_option ⇒ Object
-
#timeless ⇒ Class
Begin an execution that should skip timestamping.
- #timeless? ⇒ Boolean
Instance Method Details
#clear_timeless_option ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/mongoid/timestamps/timeless.rb', line 67 def clear_timeless_option if counter = Timeless[name] counter -= 1 Timeless[name] = (counter == 0) ? nil : counter end true end |
#timeless ⇒ Class
Begin an execution that should skip timestamping.
59 60 61 62 63 64 65 |
# File 'lib/mongoid/timestamps/timeless.rb', line 59 def timeless counter = 0 counter += 1 if self < Mongoid::Timestamps::Created counter += 1 if self < Mongoid::Timestamps::Updated Timeless[name] = counter self end |