Class: CouchbaseOrm::Types::DateTime
- Inherits:
-
ActiveModel::Type::DateTime
- Object
- ActiveModel::Type::DateTime
- CouchbaseOrm::Types::DateTime
- Defined in:
- lib/couchbase-orm/types/date_time.rb
Instance Method Summary collapse
Instance Method Details
#cast(value) ⇒ Object
4 5 6 7 |
# File 'lib/couchbase-orm/types/date_time.rb', line 4 def cast(value) value = Time.at(value) if value.is_a?(Float) || value.is_a?(Integer) super(value)&.utc end |
#serialize(value) ⇒ Object
9 10 11 |
# File 'lib/couchbase-orm/types/date_time.rb', line 9 def serialize(value) value&.iso8601(@precision) end |