lib/trailblazer/activity/circuit.rb in trailblazer-activity-0.14.0 vs lib/trailblazer/activity/circuit.rb in trailblazer-activity-0.15.0
- old
+ new
@@ -22,11 +22,11 @@
@start_task = start_task
end
# @param args [Array] all arguments to be passed to the task's `call`
# @param task [callable] task to call
- Run = ->(task, args, **circuit_options) { task.(args, **circuit_options) }
+ Runner = ->(task, args, **circuit_options) { task.(args, **circuit_options) }
# Runs the circuit until we hit a stop event.
#
# This method throws exceptions when the returned value of a task doesn't match
# any wiring.
@@ -35,22 +35,22 @@
# @param options anything you want to pass to the first task
# @param flow_options Library-specific flow control data
# @return [last_signal, options, flow_options, *args]
#
# NOTE: returned circuit_options are discarded when calling the runner.
- def call(args, start_task: @start_task, runner: Run, **circuit_options)
- circuit_options = circuit_options.merge( runner: runner ).freeze # TODO: set the :runner option via arguments_for_call to save the merge?
+ def call(args, start_task: @start_task, runner: Runner, **circuit_options)
+ circuit_options = circuit_options.merge(runner: runner) # TODO: set the :runner option via arguments_for_call to save the merge?
task = start_task
loop do
last_signal, args, _discarded_circuit_options = runner.(
task,
args,
**circuit_options
)
# Stop execution of the circuit when we hit a stop event (< End). This could be an task's End or Suspend.
- return [ last_signal, args ] if @stop_events.include?(task) # DISCUSS: return circuit_options here?
+ return [last_signal, args] if @stop_events.include?(task)
if (next_task = next_for(task, last_signal))
task = next_task
else
raise IllegalSignalError.new(