Module: Mongoid::Extensions::DateTime
- Defined in:
- build/mongoid-6.1/lib/mongoid/extensions/date_time.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#__mongoize_time__ ⇒ Time
Mongoize the date time into a time.
-
#mongoize ⇒ Time
Turn the object from the ruby type we deal with to a Mongo friendly type.
Instance Method Details
#__mongoize_time__ ⇒ Time
Mongoize the date time into a time.
14 15 16 17 18 19 20 21 22 |
# File 'build/mongoid-6.1/lib/mongoid/extensions/date_time.rb', line 14 def __mongoize_time__ return to_time if utc? && Mongoid.use_utc? if Mongoid.use_activesupport_time_zone? in_time_zone(::Time.zone).to_time else time = to_time time.respond_to?(:getlocal) ? time.getlocal : time end end |
#mongoize ⇒ Time
Turn the object from the ruby type we deal with to a Mongo friendly type.
33 34 35 |
# File 'build/mongoid-6.1/lib/mongoid/extensions/date_time.rb', line 33 def mongoize ::DateTime.mongoize(self) end |