Class: Dor::WorkflowsIndexer

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/indexers/workflows_indexer.rb

Overview

Indexes the objects position in workflows

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource:) ⇒ WorkflowsIndexer

Returns a new instance of WorkflowsIndexer.



7
8
9
# File 'lib/dor/indexers/workflows_indexer.rb', line 7

def initialize(resource:)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



6
7
8
# File 'lib/dor/indexers/workflows_indexer.rb', line 6

def resource
  @resource
end

Instance Method Details

#to_solrHash

Returns the partial solr document for workflow concerns.

Returns:

  • (Hash)

    the partial solr document for workflow concerns



12
13
14
15
16
17
18
19
# File 'lib/dor/indexers/workflows_indexer.rb', line 12

def to_solr
  WorkflowSolrDocument.new do |combined_doc|
    workflows.each do |wf|
      doc = WorkflowIndexer.new(workflow: wf).to_solr
      combined_doc.merge!(doc)
    end
  end.to_h
end