Class: CrackPipe::Action::Result
- Inherits:
-
Object
- Object
- CrackPipe::Action::Result
- Defined in:
- lib/crack_pipe/action/result.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#history ⇒ Object
readonly
Returns the value of attribute history.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #failure? ⇒ Boolean
-
#initialize(history) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
Constructor Details
#initialize(history) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 13 14 |
# File 'lib/crack_pipe/action/result.rb', line 8 def initialize(history) last_result = history.last @context = last_result[:context] @history = history @output = last_result[:output] @success = last_result[:success] end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/crack_pipe/action/result.rb', line 6 def context @context end |
#history ⇒ Object (readonly)
Returns the value of attribute history.
6 7 8 |
# File 'lib/crack_pipe/action/result.rb', line 6 def history @history end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'lib/crack_pipe/action/result.rb', line 6 def output @output end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/crack_pipe/action/result.rb', line 16 def [](key) @context[key] end |
#failure? ⇒ Boolean
20 21 22 |
# File 'lib/crack_pipe/action/result.rb', line 20 def failure? !@success end |
#success? ⇒ Boolean
24 25 26 |
# File 'lib/crack_pipe/action/result.rb', line 24 def success? @success end |