Class: ActiveFedora::Rdf::Properties::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/rdf/properties.rb

Overview

Mapper is for backwards compatibility with AF::RDFDatastream

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Mapper

Returns a new instance of Mapper.



76
77
78
# File 'lib/active_fedora/rdf/properties.rb', line 76

def initialize(parent)
  @parent = parent
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



79
80
81
82
83
84
85
# File 'lib/active_fedora/rdf/properties.rb', line 79

def method_missing(name, *args, &block)
  properties = args.first || {}
  vocab = properties.delete(:in)
  to = properties.delete(:to) || name
  predicate = vocab.send(to)
  parent.property(name, properties.merge(predicate: predicate), &block)
end

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



75
76
77
# File 'lib/active_fedora/rdf/properties.rb', line 75

def parent
  @parent
end