Class: Smith::Workflow::Composite::Reduction
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Smith::Workflow::Composite::Reduction
- Defined in:
- lib/smith/workflow/composite/reduction.rb
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(attributes) ⇒ Reduction
constructor
A new instance of Reduction.
- #succeeded? ⇒ Boolean
Constructor Details
#initialize(attributes) ⇒ Reduction
Returns a new instance of Reduction.
17 18 19 20 21 22 23 24 |
# File 'lib/smith/workflow/composite/reduction.rb', line 17 def initialize(attributes) super valid = status == :succeeded ? error.nil? && failed_branch_key.nil? : error && failed_branch_key raise ArgumentError, "composite reduction fields do not match status" unless valid self.attributes.freeze freeze end |
Instance Method Details
#failed? ⇒ Boolean
27 |
# File 'lib/smith/workflow/composite/reduction.rb', line 27 def failed? = status == :failed |
#succeeded? ⇒ Boolean
26 |
# File 'lib/smith/workflow/composite/reduction.rb', line 26 def succeeded? = status == :succeeded |