Class: Dor::CompositeIndexer::Instance
- Inherits:
-
Object
- Object
- Dor::CompositeIndexer::Instance
- Defined in:
- lib/dor/indexers/composite_indexer.rb
Instance Attribute Summary collapse
-
#indexers ⇒ Object
readonly
Returns the value of attribute indexers.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(indexers, resource:) ⇒ Instance
constructor
A new instance of Instance.
-
#to_solr ⇒ Hash
The merged solr document for all the sub-indexers.
Constructor Details
#initialize(indexers, resource:) ⇒ Instance
Returns a new instance of Instance.
16 17 18 19 |
# File 'lib/dor/indexers/composite_indexer.rb', line 16 def initialize(indexers, resource:) @resource = resource @indexers = indexers.map { |i| i.new(resource: resource) } end |
Instance Attribute Details
#indexers ⇒ Object (readonly)
Returns the value of attribute indexers.
15 16 17 |
# File 'lib/dor/indexers/composite_indexer.rb', line 15 def indexers @indexers end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
15 16 17 |
# File 'lib/dor/indexers/composite_indexer.rb', line 15 def resource @resource end |
Instance Method Details
#to_solr ⇒ Hash
Returns the merged solr document for all the sub-indexers.
22 23 24 |
# File 'lib/dor/indexers/composite_indexer.rb', line 22 def to_solr indexers.map(&:to_solr).inject({}, &:merge) end |