Class: Valkyrie::Persistence::Shared::JSONValueMapper::HashValue
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Shared::JSONValueMapper::HashValue
- Defined in:
- lib/valkyrie/persistence/shared/json_value_mapper.rb
Overview
Converts RDF::Literal typed-literals from JSON-LD stored into an
{RDF::Literal}
Instance Attribute Summary
Attributes inherited from ValueMapper
Class Method Summary collapse
-
.handles?(value) ⇒ Boolean
Determines whether or not a value is a Hash containing the key “@value”.
Instance Method Summary collapse
-
#result ⇒ RDF::Literal
Constructs a RDF::Literal object using the Object keyed to “@value” in the value Hash, as well as the language keyed to “@language” and datatype keyed to “@type”.
Methods inherited from ValueMapper
Constructor Details
This class inherits a constructor from Valkyrie::ValueMapper
Class Method Details
.handles?(value) ⇒ Boolean
Determines whether or not a value is a Hash containing the key “@value”
37 38 39 |
# File 'lib/valkyrie/persistence/shared/json_value_mapper.rb', line 37 def self.handles?(value) value.is_a?(Hash) && value["@value"] end |
Instance Method Details
#result ⇒ RDF::Literal
Constructs a RDF::Literal object using the Object keyed to “@value” in the value Hash, as well as the language keyed to “@language” and datatype keyed to “@type”
45 46 47 48 49 |
# File 'lib/valkyrie/persistence/shared/json_value_mapper.rb', line 45 def result RDF::Literal.new(value["@value"], language: value["@language"], datatype: value["@type"]) end |