Class: RigidWorkflow::StepResult

Inherits:
Object
  • Object
show all
Defined in:
lib/rigid_workflow/step_result.rb

Overview

Represents the result of a workflow step execution.

Instance Method Summary collapse

Constructor Details

#initialize(status, output = {}) ⇒ StepResult

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of StepResult.



7
8
9
10
# File 'lib/rigid_workflow/step_result.rb', line 7

def initialize(status, output = {})
  @status = status.to_s
  @output = (output || {}).with_indifferent_access
end

Instance Method Details

#failure?Boolean

Returns true if the step failed all retry attempts.

Returns:

  • (Boolean)


20
21
22
# File 'lib/rigid_workflow/step_result.rb', line 20

def failure?
  @status == "failed"
end

#success?Boolean

Returns true if the step completed successfully.

Returns:

  • (Boolean)


14
15
16
# File 'lib/rigid_workflow/step_result.rb', line 14

def success?
  @status == "completed"
end

#to_hHash

Returns the output as a hash.

Returns:

  • (Hash)


28
29
30
# File 'lib/rigid_workflow/step_result.rb', line 28

def to_h
  @output.to_h
end