class FlowObject::Runner
Attributes
failure[R]
flow[R]
step_name[R]
Public Class Methods
new(plan, callbacks, halt_if_proc)
click to toggle source
# File lib/flow_object/runner.rb, line 5 def initialize(plan, callbacks, halt_if_proc) @plan = plan @flow = flow @failure = false @step_name = nil @callbacks = callbacks @step_index = 0 @halt_if_proc = halt_if_proc end
Public Instance Methods
execute_plan()
click to toggle source
# File lib/flow_object/runner.rb, line 15 def execute_plan @flow = call_flow_builder after_flow_check(flow.public_send(@step_name)) self end
Private Instance Methods
after_flow_check(object)
click to toggle source
# File lib/flow_object/runner.rb, line 29 def after_flow_check(object) @callbacks.after_flow_check.call(object) end
after_flow_initialize(object)
click to toggle source
# File lib/flow_object/runner.rb, line 37 def after_flow_initialize(object) @callbacks.after_flow_initialize.call(object) end
after_input_check(object)
click to toggle source
# File lib/flow_object/runner.rb, line 41 def after_input_check(object) @callbacks.after_input_check.call(object) end
after_input_initialize(object)
click to toggle source
# File lib/flow_object/runner.rb, line 33 def after_input_initialize(object) @callbacks.after_input_initialize.call(object) end
call_flow_builder()
click to toggle source
# File lib/flow_object/runner.rb, line 23 def call_flow_builder @plan.call do |object, id| handle_step(object, id) { throw :halt } end end
flow_step?(id)
click to toggle source
# File lib/flow_object/runner.rb, line 53 def flow_step?(id) id.group == :stage end
handle_step(object, id) { || ... }
click to toggle source
# File lib/flow_object/runner.rb, line 57 def handle_step(object, id) after_input_initialize(object) if input_step?(id) after_flow_initialize(object) if second_step? && flow_step?(id) @step_name = id.title @step_index += 1 yield if @failure = @halt_if_proc.call(object, id) after_input_check(object) if input_step?(id) end
input_step?(id)
click to toggle source
# File lib/flow_object/runner.rb, line 49 def input_step?(id) id.group == :input end
second_step?()
click to toggle source
# File lib/flow_object/runner.rb, line 45 def second_step? @step_index == 1 end