Module: Mongoid::Timestamps::Timeless::ClassMethods
- Defined in:
- build/mongoid-7.3/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
76 77 78 79 80 81 82 |
# File 'build/mongoid-7.3/lib/mongoid/timestamps/timeless.rb', line 76 def clear_timeless_option if counter = Timeless[name] counter -= 1 set_timeless_counter(counter) end true end |
#clear_timeless_option_on_update ⇒ Object
84 85 86 87 88 89 90 |
# File 'build/mongoid-7.3/lib/mongoid/timestamps/timeless.rb', line 84 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
92 93 94 |
# File 'build/mongoid-7.3/lib/mongoid/timestamps/timeless.rb', line 92 def set_timeless_counter(counter) Timeless[name] = (counter == 0) ? nil : counter end |
#timeless ⇒ Class
Begin an execution that should skip timestamping.
68 69 70 71 72 73 74 |
# File 'build/mongoid-7.3/lib/mongoid/timestamps/timeless.rb', line 68 def timeless counter = 0 counter += 1 if self < Mongoid::Timestamps::Created counter += 1 if self < Mongoid::Timestamps::Updated Timeless[name] = counter self end |