Module: Trailblazer::Activity::TaskBuilder

Defined in:
lib/trailblazer/activity/task_builder.rb

Defined Under Namespace

Classes: Task

Class Method Summary collapse

Class Method Details

.Binary(user_proc) ⇒ Object

every step is wrapped by this proc/decider. this is executed in the circuit as the actual task. Step calls step.(options, **options, flow_options) Output signal binary: true=>Right, false=>Left. Passes through all subclasses of Direction.~~~~~~~~~~~~~~~~~



7
8
9
# File 'lib/trailblazer/activity/task_builder.rb', line 7

def self.Binary(user_proc)
  Task.new(Trailblazer::Option(user_proc), user_proc)
end

.binary_signal_for(result, on_true, on_false) ⇒ Object

Translates the return value of the user step into a valid signal. Note that it passes through subclasses of Signal.



13
14
15
16
17
18
19
# File 'lib/trailblazer/activity/task_builder.rb', line 13

def self.binary_signal_for(result, on_true, on_false)
  if result.is_a?(Class) && result < Activity::Signal
    result
  else
    result ? on_true : on_false
  end
end