Class: ActionSequence::Context
- Inherits:
-
Object
- Object
- ActionSequence::Context
- Extended by:
- Forwardable
- Defined in:
- lib/action_sequence/context.rb
Overview
Context container to hold state for an Sequence of Actions
Instance Attribute Summary collapse
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
Instance Method Summary collapse
- #add_to_context!(hash) ⇒ Object
- #fail_context!(error_message) ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(initial_context: {}) ⇒ Context
constructor
A new instance of Context.
- #success? ⇒ Boolean
Constructor Details
#initialize(initial_context: {}) ⇒ Context
16 17 18 19 |
# File 'lib/action_sequence/context.rb', line 16 def initialize(initial_context: {}) @context = initial_context = nil end |
Instance Attribute Details
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
12 13 14 |
# File 'lib/action_sequence/context.rb', line 12 def end |
Instance Method Details
#add_to_context!(hash) ⇒ Object
21 22 23 |
# File 'lib/action_sequence/context.rb', line 21 def add_to_context!(hash) context.merge!(hash) end |
#fail_context!(error_message) ⇒ Object
33 34 35 |
# File 'lib/action_sequence/context.rb', line 33 def fail_context!() = end |
#failed? ⇒ Boolean
25 26 27 |
# File 'lib/action_sequence/context.rb', line 25 def failed? !.nil? end |
#success? ⇒ Boolean
29 30 31 |
# File 'lib/action_sequence/context.rb', line 29 def success? .nil? end |