Class: Valkyrie::Persistence::Shared::JSONValueMapper::URIValue

Inherits:
ValueMapper
  • Object
show all
Defined in:
lib/valkyrie/persistence/shared/json_value_mapper.rb

Overview

Converts stored URIs into RDF::URIs

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

Determines whether or not a value is a Hash containing the key “@id”

Parameters:

  • value (Object)

Returns:

  • (Boolean)

77
78
79
# File 'lib/valkyrie/persistence/shared/json_value_mapper.rb', line 77

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

Instance Method Details

#resultRDF::URI

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

Returns:


83
84
85
# File 'lib/valkyrie/persistence/shared/json_value_mapper.rb', line 83

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