Module: Mongoid::Timestamps::Timeless
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Forwardable,
ActiveSupport::Concern
|
|
Defined in: | lib/mongoid/timestamps/timeless.rb |
Overview
This module adds behavior for turning off timestamping in single or multiple calls.
Constant Summary
-
TIMELESS_TABLE_KEY =
The key to use to store the timeless table
'[mongoid]:timeless'
Class Method Summary
-
.timeless_table ⇒ Hash
Internal use only
Internal use only
Returns the in-memory thread cache of classes for which to skip timestamping.
Instance Attribute Summary
-
#timeless ⇒ Document
readonly
Begin an execution that should skip timestamping.
-
#timeless? ⇒ true | false
readonly
Returns whether the document should skip timestamping.
Instance Method Summary
-
#clear_timeless_option ⇒ true
Clears out the timeless option.
Class Method Details
.timeless_table ⇒ Hash
This method is for internal use only.
Returns the in-memory thread cache of classes for which to skip timestamping.
# File 'lib/mongoid/timestamps/timeless.rb', line 58
def timeless_table Threaded.get(TIMELESS_TABLE_KEY) { Hash.new } end
Instance Attribute Details
#timeless ⇒ Document (readonly)
Begin an execution that should skip timestamping.
# File 'lib/mongoid/timestamps/timeless.rb', line 33
def timeless self.class.timeless self end
#timeless? ⇒ true
| false
(readonly)
Returns whether the document should skip timestamping.
# File 'lib/mongoid/timestamps/timeless.rb', line 42
def timeless? self.class.timeless? end
Instance Method Details
#clear_timeless_option ⇒ true
Clears out the timeless option.
# File 'lib/mongoid/timestamps/timeless.rb', line 18
def clear_timeless_option if self.persisted? self.class.clear_timeless_option_on_update else self.class.clear_timeless_option end true end