Class: DateTime
- Inherits:
-
Object
- Object
- DateTime
- Defined in:
- lib/mongo_odm/core_ext/conversions.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.type_cast(value) ⇒ Object
164 165 166 167 |
# File 'lib/mongo_odm/core_ext/conversions.rb', line 164 def self.type_cast(value) return nil if value.nil? value.to_datetime end |
Instance Method Details
#to_mongo ⇒ Object
169 170 171 172 |
# File 'lib/mongo_odm/core_ext/conversions.rb', line 169 def to_mongo datetime = self.utc Time.utc(datetime.year, datetime.month, datetime.day, datetime.hour, datetime.min, datetime.sec) end |