Class: Wings::ResourceMapper

Inherits:
Valkyrie::ValueMapper
  • Object
show all
Defined in:
lib/wings/transformer_value_mapper.rb

Overview

Maps ‘RDF::Term` values to their underlying types.

Most importantly, this handles cases where a complex model implementing ‘RDF::Term` (e.g. an `ActiveFedora::Base` or `ActiveTriples::RDFSource`) is included as a value, casting it to an `RDF::URI` or `RDF::Node` which can be handled by `Valkyrie`.

See Also:

  • RDF::Term

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handles?(value) ⇒ Boolean

Parameters:

  • value (Object)

Returns:

  • (Boolean)


47
48
49
# File 'lib/wings/transformer_value_mapper.rb', line 47

def self.handles?(value)
  value.respond_to?(:term?) && value.term?
end

Instance Method Details

#resultRDF::Term

Returns:

  • (RDF::Term)


53
54
55
# File 'lib/wings/transformer_value_mapper.rb', line 53

def result
  value.to_term
end