Class: Valkyrie::Persistence::Postgres::ORMConverter::RDFMetadata
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Postgres::ORMConverter::RDFMetadata
- Defined in:
- lib/valkyrie/persistence/postgres/orm_converter.rb
Overview
Responsible for converting ‘metadata` JSON-B field in Valkyrie::Persistence::Postgres::ORM::Resource into an acceptable hash for Resource
Defined Under Namespace
Classes: DateValue, EnumeratorValue, HashValue, IDValue, NestedRecord, PostgresValue, URIValue
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
-
#initialize(metadata) ⇒ RDFMetadata
constructor
A new instance of RDFMetadata.
-
#result ⇒ Hash
Convert the database attribute values and map these to the existing keys in the Valkyrie Resource metadata.
Constructor Details
#initialize(metadata) ⇒ RDFMetadata
Returns a new instance of RDFMetadata.
86 87 88 89 90 |
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 86 def initialize() # nil hash values are handled by the default state in dry-types # anyways, so don't bother processing them here. @metadata = .compact end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
83 84 85 |
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 83 def @metadata end |
Instance Method Details
#result ⇒ Hash
Convert the database attribute values and map these to the existing keys in the Valkyrie Resource metadata
94 95 96 97 98 99 100 |
# File 'lib/valkyrie/persistence/postgres/orm_converter.rb', line 94 def result Hash[ .map do |key, value| [key, PostgresValue.for(value).result] end ] end |