Class: Valkyrie::Persistence::Fedora::Persister::ModelConverter::TimeValue
- Inherits:
-
MappedFedoraValue
- Object
- ValueMapper
- MappedFedoraValue
- Valkyrie::Persistence::Fedora::Persister::ModelConverter::TimeValue
- Defined in:
- lib/valkyrie/persistence/fedora/persister/model_converter.rb
Overview
Class for mapping Property objects for Time values Technically Valkyrie does not support time, but when other persisters support time
this code will make Fedora compliant with the established patterns.
https://github.com/samvera-labs/valkyrie/wiki/Supported-Data-Types
Instance Attribute Summary
Attributes inherited from ValueMapper
Class Method Summary collapse
-
.handles?(value) ⇒ Boolean
Determines whether or not the value is a Property for Time values.
Instance Method Summary collapse
-
#result ⇒ Valkyrie::Persistence::Fedora::Persister::ModelConverter::Property
Generates the Property for this Time This will first be mapped to an RDF::Literal::DateTime object such as “2018-08-08T11:24:18.2087-04:00”^^<example.com/predicate/valkyrie_datetime>.
Methods inherited from ValueMapper
Constructor Details
This class inherits a constructor from Valkyrie::ValueMapper
Class Method Details
.handles?(value) ⇒ Boolean
Determines whether or not the value is a Property for Time values
474 475 476 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 474 def self.handles?(value) value.is_a?(Property) && value.value.is_a?(Time) end |
Instance Method Details
#result ⇒ Valkyrie::Persistence::Fedora::Persister::ModelConverter::Property
Generates the Property for this Time This will first be mapped to an RDF::Literal::DateTime object such as “2018-08-08T11:24:18.2087-04:00”^^<example.com/predicate/valkyrie_datetime>
481 482 483 484 485 486 487 488 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 481 def result # cast it to datetime for storage, to preserve milliseconds and date map_value(converted_value: RDF::Literal.new( value.value.to_datetime, datatype: PermissiveSchema.valkyrie_time )) end |