Class: Teckel::Operation::Runner
- Inherits:
-
Object
- Object
- Teckel::Operation::Runner
- Defined in:
- lib/teckel/operation.rb
Overview
The default implementation for executing a single Teckel::Operation
Direct Known Subclasses
Instance Attribute Summary collapse
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
Instance Method Summary collapse
- #call(input) ⇒ Object
-
#initialize(operation) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(operation) ⇒ Runner
Returns a new instance of Runner.
99 100 101 |
# File 'lib/teckel/operation.rb', line 99 def initialize(operation) @operation = operation end |
Instance Attribute Details
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
102 103 104 |
# File 'lib/teckel/operation.rb', line 102 def operation @operation end |
Instance Method Details
#call(input) ⇒ Object
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/teckel/operation.rb', line 104 def call(input) err = catch(:failure) do simple_return = UNDEFINED out = catch(:success) do simple_return = @operation.new.call(build_input(input)) end return simple_return == UNDEFINED ? build_output(*out) : build_output(simple_return) end build_error(*err) end |