Module: Trailblazer::Circuit::Task

Defined in:
lib/trailblazer/circuit/task.rb

Class Method Summary collapse

Class Method Details

.Binary(step, on_true = Right, on_false = Left) ⇒ Object

Task::Binary aka “step” Step is binary task: true=> Right, false=>Left. Step call proc.(options, flow_options) Step is supposed to run Option::KW, so ‘step` should be Option::KW.

Returns task to call the proc with (options, flow_options), omitting ‘direction`. When called, the task always returns a direction signal.



12
13
14
15
16
# File 'lib/trailblazer/circuit/task.rb', line 12

def self.Binary(step, on_true=Right, on_false=Left)
  ->(direction, *args) do # Activity/Task interface.
    [ step.(direction, *args) ? on_true : on_false, *args ] # <=> Activity/Task interface
  end
end