Class: Teckel::Operation::Runner
- Inherits:
-
Object
- Object
- Teckel::Operation::Runner
- Defined in:
- lib/teckel/operation/runner.rb
Overview
Note:
You shouldn’t need to call this explicitly. Use MyOperation.with() or MyOperation.call() instead.
The default implementation for executing a single Teckel::Operation
Instance Attribute Summary collapse
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #call(input = nil) ⇒ Object
-
#initialize(operation, settings = UNDEFINED) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(operation, settings = UNDEFINED) ⇒ Runner
Returns a new instance of Runner.
13 14 15 |
# File 'lib/teckel/operation/runner.rb', line 13 def initialize(operation, settings = UNDEFINED) @operation, @settings = operation, settings end |
Instance Attribute Details
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
16 17 18 |
# File 'lib/teckel/operation/runner.rb', line 16 def operation @operation end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
16 17 18 |
# File 'lib/teckel/operation/runner.rb', line 16 def settings @settings end |
Instance Method Details
#call(input = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/teckel/operation/runner.rb', line 18 def call(input = nil) err = catch(:failure) do simple_return = UNDEFINED out = catch(:success) do simple_return = run(build_input(input)) end return simple_return == UNDEFINED ? build_output(*out) : build_output(simple_return) end build_error(*err) end |