Class: Stellwerk::Result
- Inherits:
-
Object
- Object
- Stellwerk::Result
- Defined in:
- lib/stellwerk/result.rb
Overview
Represents the result of a flow execution
Instance Attribute Summary collapse
-
#applied_nodes ⇒ Object
readonly
Returns the value of attribute applied_nodes.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#outputs ⇒ Object
readonly
Returns the value of attribute outputs.
Instance Method Summary collapse
-
#failure? ⇒ Boolean
Returns true if there were any errors during execution.
-
#initialize(outputs:, errors:, applied_nodes:, context:) ⇒ Result
constructor
A new instance of Result.
-
#success? ⇒ Boolean
Returns true if the flow executed without errors.
-
#to_h ⇒ Object
Convert to hash representation.
Constructor Details
#initialize(outputs:, errors:, applied_nodes:, context:) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 13 |
# File 'lib/stellwerk/result.rb', line 8 def initialize(outputs:, errors:, applied_nodes:, context:) @outputs = outputs || {} @errors = errors || [] @applied_nodes = applied_nodes || [] @context = context || {} end |
Instance Attribute Details
#applied_nodes ⇒ Object (readonly)
Returns the value of attribute applied_nodes.
6 7 8 |
# File 'lib/stellwerk/result.rb', line 6 def applied_nodes @applied_nodes end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/stellwerk/result.rb', line 6 def context @context end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/stellwerk/result.rb', line 6 def errors @errors end |
#outputs ⇒ Object (readonly)
Returns the value of attribute outputs.
6 7 8 |
# File 'lib/stellwerk/result.rb', line 6 def outputs @outputs end |
Instance Method Details
#failure? ⇒ Boolean
Returns true if there were any errors during execution
21 22 23 |
# File 'lib/stellwerk/result.rb', line 21 def failure? !success? end |
#success? ⇒ Boolean
Returns true if the flow executed without errors
16 17 18 |
# File 'lib/stellwerk/result.rb', line 16 def success? errors.empty? end |
#to_h ⇒ Object
Convert to hash representation
26 27 28 29 30 31 32 33 |
# File 'lib/stellwerk/result.rb', line 26 def to_h { outputs: outputs, errors: errors, applied_nodes: applied_nodes, context: context } end |