Module: Workflows
Defined Under Namespace
Modules: ClassMethods, StepService
Classes: Step
Constant Summary
collapse
- VERSION =
"0.1.1"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
6
7
8
|
# File 'lib/workflows.rb', line 6
def self.included(base)
base.extend ClassMethods
end
|
Instance Method Details
#initialize(service_args = {}) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/workflows.rb', line 24
def initialize(service_args = {})
wf_steps.each do |wf_step|
args = service_args.fetch(wf_step.name.to_sym)
wf_step.set_args args
end
end
|
#output ⇒ Object
53
54
55
|
# File 'lib/workflows.rb', line 53
def output
wf_steps.map { |wf_step| wf_step.output }
end
|
#run(args = {}) ⇒ Object
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/workflows.rb', line 34
def run(args = {})
previous_state = {}
wf_steps.each do |wf_step|
wf_step.set_state(previous_state)
wf_step.run
previous_state = wf_step.get_state
end
wf_steps.last.get_output
end
|
#state ⇒ Object
45
46
47
|
# File 'lib/workflows.rb', line 45
def state
wf_steps.last.get_state
end
|
#status ⇒ Object
49
50
51
|
# File 'lib/workflows.rb', line 49
def status
wf_steps.map { |wf_step| wf_step.status }
end
|