Class: Wf::CaseCommand::EndWorkitemAction

Inherits:
Object
  • Object
show all
Includes:
SimpleCommand
Defined in:
app/models/wf/case_command/end_workitem_action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workitem, user, action = :start) ⇒ EndWorkitemAction

Returns a new instance of EndWorkitemAction.



7
8
9
10
11
# File 'app/models/wf/case_command/end_workitem_action.rb', line 7

def initialize(workitem, user, action = :start)
  @workitem = workitem
  @action   = action
  @user     = user
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



6
7
8
# File 'app/models/wf/case_command/end_workitem_action.rb', line 6

def action
  @action
end

#userObject (readonly)

Returns the value of attribute user.



6
7
8
# File 'app/models/wf/case_command/end_workitem_action.rb', line 6

def user
  @user
end

#workitemObject (readonly)

Returns the value of attribute workitem.



6
7
8
# File 'app/models/wf/case_command/end_workitem_action.rb', line 6

def workitem
  @workitem
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/models/wf/case_command/end_workitem_action.rb', line 13

def call
  if action == :start
    StartWorkitem.call(workitem, user)
  elsif action == :finish
    FinishWorkitem.call(workitem, user)
  elsif action == :cancel
    CancelWorkitem.call(workitem, user)
  elsif action == :comment
    raise("Unknown action #{action}")
  end
end