Sha256: 7475c17a8c171045a92742d4c344efb295e7a23daf89022a3ddb60945f73136e

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

require 'transflow/step_dsl'
require 'transflow/transaction'

module Transflow
  # @api private
  class FlowDSL
    # @api private
    attr_reader :options

    # @api private
    attr_reader :container

    # @api private
    attr_reader :step_map

    # @api private
    def initialize(options, &block)
      @options = options
      @container = options.fetch(:container)
      @step_map = {}
      instance_exec(&block)
    end

    # @api private
    def steps(*names)
      names.reverse_each { |name| step(name) }
    end

    # @api private
    def step(name, options = {}, &block)
      StepDSL.new(name, options, container, step_map, &block).call
    end

    # @api private
    def call
      Transaction.new(step_map)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
transflow-0.2.0 lib/transflow/flow_dsl.rb
transflow-0.1.0 lib/transflow/flow_dsl.rb