Class: Hyrax::WorkflowActionInfo

Inherits:
Object
  • Object
show all
Defined in:
app/models/hyrax/workflow_action_info.rb

Overview

A simple data object for holding a user, work and their workflow proxies

this is a glorified Struct that resolves Sipity::Enitity(work) and Sipity::Agent(user) for the input given, then provides readers for its instance variables.

Examples:

info = WorkflowActionInfo.new(my_work, current_user)

info.agent # =>  #<Sipity::Agent...>
info.entity # =>  #<Sipity::Entity...>
info.work == my_work # => true
info.user == current_user # => true

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(work, user) ⇒ WorkflowActionInfo

Returns a new instance of WorkflowActionInfo.

Parameters:

  • work (Object)
  • user (::User)


21
22
23
24
25
26
# File 'app/models/hyrax/workflow_action_info.rb', line 21

def initialize(work, user)
  @work = work
  @user = user
  @entity = Sipity::Entity(work)
  @agent = Sipity::Agent(user)
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



28
29
30
# File 'app/models/hyrax/workflow_action_info.rb', line 28

def agent
  @agent
end

#entityObject (readonly)

Returns the value of attribute entity.



28
29
30
# File 'app/models/hyrax/workflow_action_info.rb', line 28

def entity
  @entity
end

#userObject (readonly)

Returns the value of attribute user.



28
29
30
# File 'app/models/hyrax/workflow_action_info.rb', line 28

def user
  @user
end

#workObject (readonly)

Returns the value of attribute work.



28
29
30
# File 'app/models/hyrax/workflow_action_info.rb', line 28

def work
  @work
end