Sha256: 7bffc092d57d0f07fbe87bb23378e86f2807d5bc3928d73d36eacd50db47eece
Contents?: true
Size: 689 Bytes
Versions: 7
Compression:
Stored size: 689 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
7 entries across 7 versions & 1 rubygems