Class: Valkyrie::Persistence::Solr::CompositeIndexer::Instance
- Inherits:
-
Object
- Object
- Valkyrie::Persistence::Solr::CompositeIndexer::Instance
- Defined in:
- lib/valkyrie/persistence/solr/composite_indexer.rb
Overview
Class providing the common method interface for the Indexer
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 ⇒ Array<Hash>
Generate the Solr Documents from the indexers.
Constructor Details
#initialize(indexers, resource:) ⇒ Instance
Returns a new instance of Instance.
27 28 29 30 |
# File 'lib/valkyrie/persistence/solr/composite_indexer.rb', line 27 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.
23 24 25 |
# File 'lib/valkyrie/persistence/solr/composite_indexer.rb', line 23 def indexers @indexers end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
23 24 25 |
# File 'lib/valkyrie/persistence/solr/composite_indexer.rb', line 23 def resource @resource end |
Instance Method Details
#to_solr ⇒ Array<Hash>
Generate the Solr Documents from the indexers
34 35 36 |
# File 'lib/valkyrie/persistence/solr/composite_indexer.rb', line 34 def to_solr indexers.map(&:to_solr).inject({}, &:merge) end |