Sha256: 726db00fd928cbb41f4c3050b9065a60fa4822bea4ea5369e0f322e636aa64d8
Contents?: true
Size: 690 Bytes
Versions: 1
Compression:
Stored size: 690 Bytes
Contents
# frozen_string_literal: true 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
business_flow-0.19.6 | lib/business_flow/default_step_executor.rb |