Class: SpecForge::Forge::Context
- Inherits:
-
Object
- Object
- SpecForge::Forge::Context
- Defined in:
- lib/spec_forge/forge/context.rb
Overview
Immutable execution context passed to callbacks and hooks
Contains the current state during forge execution including variables, the current blueprint and step, and any error that occurred.
Instance Method Summary collapse
-
#failure? ⇒ Boolean
Returns whether the context represents a failed state.
-
#initialize(**context) ⇒ Context
constructor
A new instance of Context.
-
#success? ⇒ Boolean
Returns whether the context represents a successful state.
Constructor Details
#initialize(**context) ⇒ Context
Returns a new instance of Context.
12 13 14 15 16 17 18 19 20 |
# File 'lib/spec_forge/forge/context.rb', line 12 def initialize(**context) context[:variables] ||= nil context[:forge] ||= nil context[:blueprint] ||= nil context[:step] ||= nil context[:error] ||= nil super(context) end |
Instance Method Details
#failure? ⇒ Boolean
Returns whether the context represents a failed state
36 37 38 |
# File 'lib/spec_forge/forge/context.rb', line 36 def failure? !success? end |
#success? ⇒ Boolean
Returns whether the context represents a successful state
27 28 29 |
# File 'lib/spec_forge/forge/context.rb', line 27 def success? error.nil? end |