Class: Transflow::StepDSL
- Inherits:
-
Object
- Object
- Transflow::StepDSL
- Defined in:
- lib/transflow/step_dsl.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#monadic ⇒ Object
readonly
Returns the value of attribute monadic.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#publish ⇒ Object
readonly
Returns the value of attribute publish.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name, options, container, steps, &block) ⇒ StepDSL
constructor
A new instance of StepDSL.
- #step(name, new_options = {}, &block) ⇒ Object
Constructor Details
#initialize(name, options, container, steps, &block) ⇒ StepDSL
Returns a new instance of StepDSL.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/transflow/step_dsl.rb', line 19 def initialize(name, , container, steps, &block) @name = name @options = @handler = .fetch(:with, name) @publish = .fetch(:publish, false) @monadic = .fetch(:monadic, false) @container = container @steps = steps instance_exec(&block) if block end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
11 12 13 |
# File 'lib/transflow/step_dsl.rb', line 11 def container @container end |
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
9 10 11 |
# File 'lib/transflow/step_dsl.rb', line 9 def handler @handler end |
#monadic ⇒ Object (readonly)
Returns the value of attribute monadic.
17 18 19 |
# File 'lib/transflow/step_dsl.rb', line 17 def monadic @monadic end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/transflow/step_dsl.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/transflow/step_dsl.rb', line 7 def @options end |
#publish ⇒ Object (readonly)
Returns the value of attribute publish.
15 16 17 |
# File 'lib/transflow/step_dsl.rb', line 15 def publish @publish end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
13 14 15 |
# File 'lib/transflow/step_dsl.rb', line 13 def steps @steps end |
Instance Method Details
#call ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# 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) ⇒ Object
30 31 32 |
# File 'lib/transflow/step_dsl.rb', line 30 def step(name, = {}, &block) self.class.new(name, .merge(), container, steps, &block).call end |