Class: Wf::CaseCommand::New

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow, target = nil, started_by = nil) ⇒ New

Returns a new instance of New.



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

def initialize(workflow, target = nil, started_by = nil)
  @workflow = workflow
  @target = target
  @started_by = started_by
end

Instance Attribute Details

#started_byObject (readonly)

Returns the value of attribute started_by.



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

def started_by
  @started_by
end

#targetObject (readonly)

Returns the value of attribute target.



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

def target
  @target
end

#workflowObject (readonly)

Returns the value of attribute workflow.



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

def workflow
  @workflow
end

Instance Method Details

#callObject



13
14
15
16
# File 'app/models/wf/case_command/new.rb', line 13

def call
  wf_case = workflow.cases.create!(targetable: target, started_by_workitem: started_by, state: :created)
  wf_case
end