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
technically valkyrie does not support time, but when other persister support time
this code will make fedora compliant
https://github.com/samvera-labs/valkyrie/wiki/Supported-Data-Types
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
241 242 243 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 241 def self.handles?(value) value.is_a?(Property) && value.value.is_a?(Time) end |
Instance Method Details
#result ⇒ Object
245 246 247 248 249 250 251 252 |
# File 'lib/valkyrie/persistence/fedora/persister/model_converter.rb', line 245 def result # cast it to datetime for storage, to preserve miliseconds and date map_value(converted_value: RDF::Literal.new( value.value.to_datetime, datatype: PermissiveSchema.valkyrie_time )) end |