Class: Valkyrie::Persistence::Postgres::ORMConverter::RDFMetadata::DateValue
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Postgres::ORMConverter::RDFMetadata::DateValue
- Defined in:
- lib/valkyrie/persistence/postgres/orm_converter.rb
Overview
Converts Date strings to ‘DateTime`
Instance Attribute Summary
Attributes inherited from ValueMapper
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ValueMapper
Constructor Details
This class inherits a constructor from Valkyrie::ValueMapper
Class Method Details
.handles?(value) ⇒ Boolean
129 130 131 132 133 134 135 136 137 |
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 129 def self.handles?(value) return false unless value.is_a?(String) return false unless value[4] == "-" year = value.to_s[0..3] return false unless year.length == 4 && year.to_i.to_s == year DateTime.iso8601(value) rescue false end |
Instance Method Details
#result ⇒ Object
139 140 141 |
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 139 def result DateTime.iso8601(value).utc end |