Sha256: 9b194a3fe56d9e10506bb9fa76a7ffcb1480555fac8412fb7615ba7d9ecf9df1
Contents?: true
Size: 658 Bytes
Versions: 24
Compression:
Stored size: 658 Bytes
Contents
module BusinessFlow # Default behavior for running a step queue -- execute each step in turn # halting the moment something goes wrong. Use the same flow as input # and output to all steps. class DefaultStepExecutor def initialize(step_queue, flow) @step_queue = step_queue @flow = flow end def call @step_queue.each do |step| break if @flow.errors? execute_step(step) end end protected attr_reader :flow, :step_queue def execute_step(step) catch(:halt_step) do result = step.call(@flow) result.merge_into(@flow) result end end end end
Version data entries
24 entries across 24 versions & 1 rubygems