Class: DorIndexing::Indexers::CompositeIndexer::Instance
- Inherits:
-
Object
- Object
- DorIndexing::Indexers::CompositeIndexer::Instance
- Defined in:
- lib/dor_indexing/indexers/composite_indexer.rb
Overview
Instance for a composite indexer
Instance Attribute Summary collapse
-
#indexers ⇒ Object
readonly
Returns the value of attribute indexers.
Instance Method Summary collapse
-
#initialize(indexers) ⇒ Instance
constructor
A new instance of Instance.
-
#to_solr ⇒ Hash
The merged solr document for all the sub-indexers.
Constructor Details
#initialize(indexers) ⇒ Instance
Returns a new instance of Instance.
22 23 24 25 26 27 28 |
# File 'lib/dor_indexing/indexers/composite_indexer.rb', line 22 def initialize(indexers, **) @indexers = indexers.map do |i| i.new(**) rescue ArgumentError => e raise ArgumentError, "Unable to initialize #{i}. #{e.}" end end |
Instance Attribute Details
#indexers ⇒ Object (readonly)
Returns the value of attribute indexers.
20 21 22 |
# File 'lib/dor_indexing/indexers/composite_indexer.rb', line 20 def indexers @indexers end |
Instance Method Details
#to_solr ⇒ Hash
Returns the merged solr document for all the sub-indexers.
31 32 33 |
# File 'lib/dor_indexing/indexers/composite_indexer.rb', line 31 def to_solr indexers.map(&:to_solr).inject({}, &:merge) end |