Class: ActiveFedora::RDF::FieldMap

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/active_fedora/rdf/field_map.rb

Overview

Transient class that maps solr field names, without their suffixes, to the values and behaviors that are used to transforming them for insertion into the solr document. It partially extends Ruby’s Hash class, similar to the way ActiveFedora::Indexing::Map does, but only with selected methods as outlined in def_delegators.

Defined Under Namespace

Classes: Builder, PolymorphicBuilder, PropertyBuilder, ResourceBuilder

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) {|_self| ... } ⇒ FieldMap

Returns a new instance of FieldMap.

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
# File 'lib/active_fedora/rdf/field_map.rb', line 11

def initialize(hash = {}, &_block)
  @hash = hash
  yield self if block_given?
end

Instance Method Details

#insert(name, index_field_config, object) ⇒ Object

Inserts each solr field map configuration into the FieldMap class

Parameters:



20
21
22
23
# File 'lib/active_fedora/rdf/field_map.rb', line 20

def insert(name, index_field_config, object)
  self[index_field_config.key.to_s] ||= FieldMapEntry.new
  PolymorphicBuilder.new(self[index_field_config.key.to_s], index_field_config, object, name).build
end