Class: Hyrax::Workflow::StatusListService

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/workflow/status_list_service.rb

Overview

Finds a list of works that we can perform a workflow action on

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, filter_condition) ⇒ StatusListService

Returns a new instance of StatusListService.

Parameters:

  • context (#current_user, #logger)
  • filter_condition (String)

    a solr filter



7
8
9
10
# File 'app/services/hyrax/workflow/status_list_service.rb', line 7

def initialize(context, filter_condition)
  @context = context
  @filter_condition = filter_condition
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



12
13
14
# File 'app/services/hyrax/workflow/status_list_service.rb', line 12

def context
  @context
end

Instance Method Details

#eachArray<StatusRow>

TODO: We will want to paginate this

Returns:

  • (Array<StatusRow>)

    a list of results that the given user can take action on.



16
17
18
19
20
21
# File 'app/services/hyrax/workflow/status_list_service.rb', line 16

def each
  return enum_for(:each) unless block_given?
  solr_documents.each do |doc|
    yield doc
  end
end

#userObject

TODO: Make this private for version 1.0



24
25
26
# File 'app/services/hyrax/workflow/status_list_service.rb', line 24

def user
  context.current_user
end