Class: Valkyrie::Persistence::Solr::ORMConverter::DateTimeValue
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Solr::ORMConverter::DateTimeValue
- Defined in:
- lib/valkyrie/persistence/solr/orm_converter.rb
Overview
Converts a datetime in Solr into a 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
263 264 265 266 267 268 |
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 263 def self.handles?(value) return false unless value.to_s.start_with?("datetime-") DateTime.iso8601(value.sub(/^datetime-/, '')).utc rescue false end |
Instance Method Details
#result ⇒ Object
270 271 272 |
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 270 def result DateTime.parse(value.sub(/^datetime-/, '')).utc end |