Class: Opie::Operation
- Inherits:
-
Object
- Object
- Opie::Operation
- Defined in:
- lib/opie/operation.rb
Constant Summary collapse
- FAIL =
'__STEP_FAILED__'.freeze
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#failure ⇒ Object
readonly
Returns the value of attribute failure.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Class Method Summary collapse
Instance Method Summary collapse
- #call(input = nil, context = nil) ⇒ Object
- #failure? ⇒ Boolean
- #failures ⇒ Object
- #success? ⇒ Boolean
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/opie/operation.rb', line 5 def context @context end |
#failure ⇒ Object (readonly)
Returns the value of attribute failure.
5 6 7 |
# File 'lib/opie/operation.rb', line 5 def failure @failure end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
5 6 7 |
# File 'lib/opie/operation.rb', line 5 def output @output end |
Class Method Details
.call(input = nil, context = nil) ⇒ Object
26 27 28 |
# File 'lib/opie/operation.rb', line 26 def call(input = nil, context = nil) new.call(input, context) end |
.step(name) ⇒ Object
30 31 32 |
# File 'lib/opie/operation.rb', line 30 def step(name) add_step(name) end |
.step_list ⇒ Object
34 35 36 |
# File 'lib/opie/operation.rb', line 34 def step_list @steps ||= [] end |
Instance Method Details
#call(input = nil, context = nil) ⇒ Object
7 8 9 10 11 |
# File 'lib/opie/operation.rb', line 7 def call(input = nil, context = nil) @context = context execute_steps(input) self end |
#failure? ⇒ Boolean
13 14 15 |
# File 'lib/opie/operation.rb', line 13 def failure? failure end |
#failures ⇒ Object
21 22 23 |
# File 'lib/opie/operation.rb', line 21 def failures [failure].compact end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/opie/operation.rb', line 17 def success? !failure? end |