Class: Linearly::Mixins::StepCollection::Reducer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/linearly/mixins/step_collection.rb

Overview

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

Reducer encapsulates the logic required to process a single Step in a larger collection.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.reduce(input, step) ⇒ Statefully::State

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.

Public interface for the Linearly::Mixins::StepCollection::Reducer

Parameters:

  • input (Statefully::State)
  • step (Step)

Returns:

  • (Statefully::State)


34
35
36
# File 'lib/linearly/mixins/step_collection.rb', line 34

def self.reduce(input, step)
  new(input: input, step: step).reduce
end

Instance Method Details

#reduceStatefully::State

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.

Internal Reducer method to create Step output

Returns:

  • (Statefully::State)


42
43
44
45
46
# File 'lib/linearly/mixins/step_collection.rb', line 42

def reduce
  return input if input.failed? || input.finished?
  return input.fail(bad_output_error) unless state_returned?
  output
end