Class: Trailblazer::Activity::TaskWrap::Pipeline::TaskAdapter
- Inherits:
-
Circuit::TaskAdapter
- Object
- Circuit::TaskAdapter
- Trailblazer::Activity::TaskWrap::Pipeline::TaskAdapter
- Defined in:
- lib/trailblazer/activity/task_wrap/pipeline.rb
Overview
Implements adapter for a callable in a Pipeline.
Class Method Summary collapse
-
.for_step(callable) ⇒ Object
Returns a TaskAdapter instance that can be used directly in a Pipeline.
Instance Method Summary collapse
Methods inherited from Circuit::TaskAdapter
binary_signal_for, #initialize, #inspect
Constructor Details
This class inherits a constructor from Trailblazer::Activity::Circuit::TaskAdapter
Class Method Details
.for_step(callable) ⇒ Object
Returns a Trailblazer::Activity::TaskWrap::Pipeline::TaskAdapter instance that can be used directly in a Pipeline. When ‘call`ed, it returns a Pipeline-interface return set.
69 70 71 72 73 |
# File 'lib/trailblazer/activity/task_wrap/pipeline.rb', line 69 def self.for_step(callable, **) circuit_step = Circuit.Step(callable, option: false) # Since we don't have {:exec_context} in Pipeline, Option doesn't make much sense. TaskAdapter.new(circuit_step) # return a {Pipeline::TaskAdapter} end |
Instance Method Details
#call(wrap_ctx, args) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/trailblazer/activity/task_wrap/pipeline.rb', line 75 def call(wrap_ctx, args) _result, _new_wrap_ctx = @circuit_step.([wrap_ctx, args]) # For funny reasons, the Circuit::Step's call interface is compatible to the Pipeline's. # DISCUSS: we're mutating wrap_ctx, that's the whole point of this abstraction (plus kwargs). return wrap_ctx, args end |