class Transflow::StepDSL

Attributes

container[R]
handler[R]
monadic[R]
name[R]
options[R]
publish[R]
steps[R]

Public Class Methods

new(name, options, container, steps, &block) click to toggle source
# File lib/transflow/step_dsl.rb, line 19
def initialize(name, options, container, steps, &block)
  @name = name
  @options = options
  @handler = options.fetch(:with, name)
  @publish = options.fetch(:publish, false)
  @monadic = options.fetch(:monadic, false)
  @container = container
  @steps = steps
  instance_exec(&block) if block
end

Public Instance Methods

call() click to toggle source
# File lib/transflow/step_dsl.rb, line 34
def call
  operation = container[handler]

  step =
    if publish
      Publisher[name, operation, monadic: monadic]
    else
      operation
    end

  steps[name] = step
end
step(name, new_options = {}, &block) click to toggle source
# File lib/transflow/step_dsl.rb, line 30
def step(name, new_options = {}, &block)
  self.class.new(name, options.merge(new_options), container, steps, &block).call
end