Class: Hyrax::Workflow::ActionableObjects
- Inherits:
-
Object
- Object
- Hyrax::Workflow::ActionableObjects
- Includes:
- Enumerable
- Defined in:
- app/services/hyrax/workflow/actionable_objects.rb
Overview
Produces a list of workflow-ready objects for a given user. Results are given as a presenter objects with SolrDocument-like behavior, with added support for workflow states.
Instance Attribute Summary collapse
Instance Method Summary collapse
- #each ⇒ Hyrax::Workflow::ObjectInWorkflowDecorator
-
#initialize(user:) ⇒ ActionableObjects
constructor
A new instance of ActionableObjects.
Constructor Details
#initialize(user:) ⇒ ActionableObjects
Returns a new instance of ActionableObjects.
26 27 28 |
# File 'app/services/hyrax/workflow/actionable_objects.rb', line 26 def initialize(user:) @user = user end |
Instance Attribute Details
#user ⇒ ::User
22 23 24 |
# File 'app/services/hyrax/workflow/actionable_objects.rb', line 22 def user @user end |
Instance Method Details
#each ⇒ Hyrax::Workflow::ObjectInWorkflowDecorator
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/services/hyrax/workflow/actionable_objects.rb', line 32 def each return enum_for(:each) unless block_given? ids_and_states = id_state_pairs return if ids_and_states.none? docs = Hyrax::SolrQueryService.new.with_ids(ids: ids_and_states.map(&:first)).solr_documents docs.each do |solr_doc| object = ObjectInWorkflowDecorator.new(solr_doc) _, state = ids_and_states.find { |id, _| id == object.id } object.workflow_state = state yield object end end |