Class: Smith::Workflow::Composite::Reducer

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/smith/workflow/composite/reducer.rb

Instance Method Summary collapse

Instance Method Details

#callObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/smith/workflow/composite/reducer.rb', line 22

def call
  outcome_set = OutcomeAccumulator.new(plan:, outcomes:).call
  ordered = outcome_set.ordered
  validate_effects!(ordered)
  effects = merged_effects(ordered)
  failure_seen, selected_failure = failure_state(ordered)
  return successful_reduction(outcome_set.output, effects) unless failure_seen

  failed_reduction(selected_failure, effects)
end