Class: Trailblazer::Activity::Circuit::Step
- Inherits:
-
Object
- Object
- Trailblazer::Activity::Circuit::Step
- Defined in:
- lib/trailblazer/activity/circuit/task_adapter.rb
Overview
#call translates the incoming circuit-interface to the step-interface, and returns the return value of the user’s callable. By design, it is not circuit-interface compatible.
Direct Known Subclasses
Defined Under Namespace
Classes: Option
Instance Method Summary collapse
-
#call(ctx, flow_options, **circuit_options) ⇒ Object
Translate the circuit interface to the step’s step-interface.
-
#initialize(step, user_proc) ⇒ Step
constructor
A new instance of Step.
Constructor Details
#initialize(step, user_proc) ⇒ Step
Returns a new instance of Step.
24 25 26 27 |
# File 'lib/trailblazer/activity/circuit/task_adapter.rb', line 24 def initialize(step, user_proc, **) @step = step @user_proc = user_proc end |
Instance Method Details
#call(ctx, flow_options, **circuit_options) ⇒ Object
Translate the circuit interface to the step’s step-interface. However, this only translates the calling interface, not the returning.
31 32 33 34 35 |
# File 'lib/trailblazer/activity/circuit/task_adapter.rb', line 31 def call((ctx, ), **) result = @step.(ctx, **ctx.to_hash) # in an immutable environment we should return the ctx from the step. return result, ctx end |