Class: Smith::Workflow::PreparedStepExecutionResult
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Smith::Workflow::PreparedStepExecutionResult
- Defined in:
- lib/smith/workflow/prepared_step_execution_result.rb
Class Method Summary collapse
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(attributes) ⇒ PreparedStepExecutionResult
constructor
A new instance of PreparedStepExecutionResult.
- #step_snapshot ⇒ Object
- #succeeded? ⇒ Boolean
Constructor Details
#initialize(attributes) ⇒ PreparedStepExecutionResult
Returns a new instance of PreparedStepExecutionResult.
20 21 22 23 24 25 26 27 |
# File 'lib/smith/workflow/prepared_step_execution_result.rb', line 20 def initialize(attributes) owned = attributes.dup owned[:step] = snapshot(owned.fetch(:step), freeze_copy: true, preserved_error: owned[:error]) super(owned) validate_shape! self.attributes.freeze freeze end |
Class Method Details
.from_step(step) ⇒ Object
15 16 17 18 |
# File 'lib/smith/workflow/prepared_step_execution_result.rb', line 15 def self.from_step(step) error = step[:error] new(status: error ? :failed : :succeeded, step:, error:) end |
Instance Method Details
#failed? ⇒ Boolean
30 |
# File 'lib/smith/workflow/prepared_step_execution_result.rb', line 30 def failed? = status == :failed |
#step_snapshot ⇒ Object
31 |
# File 'lib/smith/workflow/prepared_step_execution_result.rb', line 31 def step_snapshot = snapshot(step, freeze_copy: false, preserved_error: error) |
#succeeded? ⇒ Boolean
29 |
# File 'lib/smith/workflow/prepared_step_execution_result.rb', line 29 def succeeded? = status == :succeeded |