Class: Smith::Workflow::Composite::BranchOutcome
- Inherits:
-
Payload
- Object
- Dry::Struct
- Payload
- Smith::Workflow::Composite::BranchOutcome
show all
- Defined in:
- lib/smith/workflow/composite/branch_outcome.rb
Constant Summary
Constants inherited
from Payload
Payload::MAX_SERIALIZED_BYTES
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BranchOutcome.
87
88
89
90
91
92
93
94
|
# File 'lib/smith/workflow/composite/branch_outcome.rb', line 87
def initialize(attributes)
owned = self.class.normalize_attributes(attributes)
owned[:output] = self.class.send(:normalize_output, owned[:output])
super(owned)
validate_shape!
expected = PayloadDigest.call(self.class.send(:serializable, to_h.except(:digest)))
raise ArgumentError, "composite branch outcome digest does not match" unless digest == expected
end
|
Class Method Details
.failed(plan_digest:, branch:, error:, effects:) ⇒ Object
35
36
37
|
# File 'lib/smith/workflow/composite/branch_outcome.rb', line 35
def failed(plan_digest:, branch:, error:, effects:)
build(plan_digest:, branch:, effects:, status: :failed, output: nil, error:)
end
|
.normalize_attributes(attributes) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/smith/workflow/composite/branch_outcome.rb', line 39
def normalize_attributes(attributes)
normalized = super
normalize_status!(normalized)
normalize_error!(normalized)
normalize_effects!(normalized)
normalized
end
|
.succeeded(plan_digest:, branch:, output:, effects:) ⇒ Object
31
32
33
|
# File 'lib/smith/workflow/composite/branch_outcome.rb', line 31
def succeeded(plan_digest:, branch:, output:, effects:)
build(plan_digest:, branch:, effects:, status: :succeeded, output:, error: nil)
end
|
Instance Method Details
#failed? ⇒ Boolean
97
|
# File 'lib/smith/workflow/composite/branch_outcome.rb', line 97
def failed? = status == :failed
|
#succeeded? ⇒ Boolean
96
|
# File 'lib/smith/workflow/composite/branch_outcome.rb', line 96
def succeeded? = status == :succeeded
|