Module: Mongoid::Timestamps::Timeless::ClassMethods
- Defined in:
- build/mongoid-6.1/lib/mongoid/timestamps/timeless.rb
Instance Method Summary collapse
- #clear_timeless_option ⇒ Object
- #clear_timeless_option_on_update ⇒ Object
- #set_timeless_counter(counter) ⇒ Object
-
#timeless ⇒ Class
Begin an execution that should skip timestamping.
- #timeless? ⇒ Boolean
Instance Method Details
#clear_timeless_option ⇒ Object
72 73 74 75 76 77 78 |
# File 'build/mongoid-6.1/lib/mongoid/timestamps/timeless.rb', line 72 def clear_timeless_option if counter = Timeless[name] counter -= 1 set_timeless_counter(counter) end true end |
#clear_timeless_option_on_update ⇒ Object
80 81 82 83 84 85 86 |
# File 'build/mongoid-6.1/lib/mongoid/timestamps/timeless.rb', line 80 def clear_timeless_option_on_update if counter = Timeless[name] counter -= 1 if self < Mongoid::Timestamps::Created counter -= 1 if self < Mongoid::Timestamps::Updated set_timeless_counter(counter) end end |
#set_timeless_counter(counter) ⇒ Object
88 89 90 |
# File 'build/mongoid-6.1/lib/mongoid/timestamps/timeless.rb', line 88 def set_timeless_counter(counter) Timeless[name] = (counter == 0) ? nil : counter end |
#timeless ⇒ Class
Begin an execution that should skip timestamping.
64 65 66 67 68 69 70 |
# File 'build/mongoid-6.1/lib/mongoid/timestamps/timeless.rb', line 64 def timeless counter = 0 counter += 1 if self < Mongoid::Timestamps::Created counter += 1 if self < Mongoid::Timestamps::Updated Timeless[name] = counter self end |