Class: Valkyrie::Persistence::Solr::ORMConverter::NestedResourceURI

Inherits:
ValueMapper
  • Object
show all
Defined in:
lib/valkyrie/persistence/solr/orm_converter.rb

Overview

Class for handling serialized Hashes for URIs in Solr fields

Instance Attribute Summary

Attributes inherited from ValueMapper

#calling_mapper, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ValueMapper

for, #initialize, register

Constructor Details

This class inherits a constructor from Valkyrie::ValueMapper

Class Method Details

.handles?(value) ⇒ Boolean

Note:

this is used to determine whether or not this is a nested URI for an attribute

Determines whether or not an Object is a Hash with a URI string mapped to the “@id” key

Parameters:

  • value (Object)

Returns:

  • (Boolean)


334
335
336
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 334

def self.handles?(value)
  value.is_a?(Hash) && value[:@id]
end

Instance Method Details

#resultRDF::URI

Constructs a RDF::URI object using the value keyed to :@id in the Property Hash value

Returns:



340
341
342
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 340

def result
  RDF::URI(value[:@id])
end