Class: Wf::CaseCommand::AddToken

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wf_case, place) ⇒ AddToken

Returns a new instance of AddToken.



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

def initialize(wf_case, place)
  @wf_case = wf_case
  @place = place
end

Instance Attribute Details

#placeObject (readonly)

Returns the value of attribute place.



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

def place
  @place
end

#wf_caseObject (readonly)

Returns the value of attribute wf_case.



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

def wf_case
  @wf_case
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
# File 'app/models/wf/case_command/add_token.rb', line 12

def call
  wf_case.tokens.create!(
    workflow: wf_case.workflow,
    place: place,
    state: :free
  )
end