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.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#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(*args, &block) ⇒ Object
Constructor Details
#initialize(name, options, container, steps, &block) ⇒ StepDSL
Returns a new instance of StepDSL.
15 16 17 18 19 20 21 22 |
# File 'lib/transflow/step_dsl.rb', line 15 def initialize(name, , container, steps, &block) @name = name @handler = .fetch(:with, name) @publish = .fetch(:publish, false) @container = container @steps = steps instance_exec(&block) if block end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
9 10 11 |
# File 'lib/transflow/step_dsl.rb', line 9 def container @container end |
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
7 8 9 |
# File 'lib/transflow/step_dsl.rb', line 7 def handler @handler 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 |
#publish ⇒ Object (readonly)
Returns the value of attribute publish.
13 14 15 |
# File 'lib/transflow/step_dsl.rb', line 13 def publish @publish end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
11 12 13 |
# File 'lib/transflow/step_dsl.rb', line 11 def steps @steps end |
Instance Method Details
#call ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/transflow/step_dsl.rb', line 28 def call operation = container[handler] step = if publish Publisher.new(name, operation) else operation end steps[name] = step end |
#step(*args, &block) ⇒ Object
24 25 26 |
# File 'lib/transflow/step_dsl.rb', line 24 def step(*args, &block) self.class.new(*args, container, steps, &block).call end |