Class: Teckel::Chain::Runner
- Inherits:
-
Object
- Object
- Teckel::Chain::Runner
- Defined in:
- lib/teckel/chain/runner.rb
Overview
The default implementation for executing a Teckel::Chain
Instance Attribute Summary collapse
-
#chain ⇒ Object
readonly
Returns the value of attribute chain.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
-
#call(input = nil) ⇒ Teckel::Chain::Result
Run steps.
-
#initialize(chain, settings = UNDEFINED) ⇒ Runner
constructor
A new instance of Runner.
- #steps ⇒ Object
Constructor Details
#initialize(chain, settings = UNDEFINED) ⇒ Runner
Returns a new instance of Runner.
15 16 17 |
# File 'lib/teckel/chain/runner.rb', line 15 def initialize(chain, settings = UNDEFINED) @chain, @settings = chain, settings end |
Instance Attribute Details
#chain ⇒ Object (readonly)
Returns the value of attribute chain.
18 19 20 |
# File 'lib/teckel/chain/runner.rb', line 18 def chain @chain end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
18 19 20 |
# File 'lib/teckel/chain/runner.rb', line 18 def settings @settings end |
Instance Method Details
#call(input = nil) ⇒ Teckel::Chain::Result
Run steps
26 27 28 29 |
# File 'lib/teckel/chain/runner.rb', line 26 def call(input = nil) step_result = run(input) chain.result_constructor.call(*step_result) end |
#steps ⇒ Object
31 32 33 |
# File 'lib/teckel/chain/runner.rb', line 31 def steps settings == UNDEFINED ? chain.steps : steps_with_settings end |