Class: Sevgi::Executor::Result
- Inherits:
-
Data
- Object
- Data
- Sevgi::Executor::Result
- Defined in:
- lib/sevgi/executor/result.rb
Overview
Describes the outcome of one executor invocation.
A successful result has a value and no error. A captured script, file, or library failure has an Error and may retain a value produced before the failure. The source stack is an immutable snapshot in load order; it is never shared with the executor's internal mutable state.
Instance Attribute Summary collapse
-
#error ⇒ Sevgi::Executor::Error?
readonly
Captured failure, or nil after successful execution.
-
#stack ⇒ Array<String>
readonly
Frozen owned source-path snapshot in load order.
-
#value ⇒ Object?
readonly
Last value produced, or nil when no value was produced.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Reports whether execution captured an error.
-
#initialize(value:, error:, stack:) ⇒ void
constructor
Creates an execution result.
-
#success? ⇒ Boolean
Reports whether execution completed without a captured error.
Constructor Details
#initialize(value:, error:, stack:) ⇒ void
Creates an execution result.
39 40 41 |
# File 'lib/sevgi/executor/result.rb', line 39 def initialize(value:, error:, stack:) super(value:, error:, stack: Array(stack).map { it.dup.freeze }.freeze) end |
Instance Attribute Details
#error ⇒ Sevgi::Executor::Error? (readonly)
Returns captured failure, or nil after successful execution.
26 27 28 |
# File 'lib/sevgi/executor/result.rb', line 26 def error @error end |
#stack ⇒ Array<String> (readonly)
Returns frozen owned source-path snapshot in load order.
26 27 28 |
# File 'lib/sevgi/executor/result.rb', line 26 def stack @stack end |
#value ⇒ Object? (readonly)
Returns last value produced, or nil when no value was produced.
26 27 28 |
# File 'lib/sevgi/executor/result.rb', line 26 def value @value end |
Instance Method Details
#error? ⇒ Boolean
Reports whether execution captured an error.
51 |
# File 'lib/sevgi/executor/result.rb', line 51 def error? = !success? |
#success? ⇒ Boolean
Reports whether execution completed without a captured error.
47 |
# File 'lib/sevgi/executor/result.rb', line 47 def success? = error.nil? |