lib/transflow/step_dsl.rb in transflow-0.2.0 vs lib/transflow/step_dsl.rb in transflow-0.3.0
- old
+ new
@@ -2,36 +2,42 @@
module Transflow
class StepDSL
attr_reader :name
+ attr_reader :options
+
attr_reader :handler
attr_reader :container
attr_reader :steps
attr_reader :publish
+ attr_reader :monadic
+
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
- def step(*args, &block)
- self.class.new(*args, container, steps, &block).call
+ def step(name, new_options = {}, &block)
+ self.class.new(name, options.merge(new_options), container, steps, &block).call
end
def call
operation = container[handler]
step =
if publish
- Publisher.new(name, operation)
+ Publisher[name, operation, monadic: monadic]
else
operation
end
steps[name] = step