Module: Trailblazer::Circuit::Wrap::Runner
- Defined in:
- lib/trailblazer/circuit/wrap.rb
Overview
The runner is passed into Circuit#call( runner: Runner ) and is called for every task in the circuit. Its primary job is to actually ‘call` the task.
Here, we extend this, and wrap the task ‘call` into its own pipeline, so we can add external behavior per task.
Constant Summary collapse
- NIL_WRAPS =
here for Ruby 2.0 compat.
"Please provide :wrap_static"
- NIL_ALTERATION =
here for Ruby 2.0 compat.
"Please provide :wrap_runtime"
Class Method Summary collapse
Class Method Details
.call(task, direction, options, wrap_static: raise(NIL_WRAPS), wrap_runtime: raise(NIL_ALTERATION), **flow_options) ⇒ Object
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.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/trailblazer/circuit/wrap.rb', line 12 def self.call(task, direction, , wrap_static:raise(NIL_WRAPS), wrap_runtime:raise(NIL_ALTERATION), **) task_wrap = apply_alterations(task, wrap_static, wrap_runtime) wrap_config = { task: task } # Call the task_wrap circuit: # |-- Start # |-- Trace.capture_args [optional] # |-- Call (call actual task) # |-- Trace.capture_return [optional] # |-- End # Pass empty flow_options to the task_wrap, so it doesn't infinite-loop. task_wrap.( task_wrap[:Start], , {}, wrap_config, .merge( wrap_static: wrap_static, wrap_runtime: wrap_runtime) ) end |