Class: Valkyrie::Persistence::Solr::ORMConverter::URIValue

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

Overview

Converts a stored URI value in solr into a RDF::URI

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 determines whether or not this should be mapped to a URI

Determines whether or not a string representation of an Object is prefixed with “uri-”

Parameters:

  • value (Object)

Returns:

  • (Boolean)


248
249
250
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 248

def self.handles?(value)
  value.to_s.start_with?("uri-")
end

Instance Method Details

#resultRDF::URI

Constructs a new RDF::URI object using the ID parsed from the Solr field

Returns:



254
255
256
# File 'lib/valkyrie/persistence/solr/orm_converter.rb', line 254

def result
  ::RDF::URI.new(value.sub(/^uri-/, ''))
end