Class: Trailblazer::Macro::AssignVariable
- Inherits:
-
Object
- Object
- Trailblazer::Macro::AssignVariable
- Defined in:
- lib/trailblazer/macro.rb
Overview
Run user_proc with “step interface” and assign its return value to ctx. This is experimental.
Instance Method Summary collapse
- #call(ctx, flow_options, **circuit_options) ⇒ Object
-
#initialize(return_value_step, variable_name:) ⇒ AssignVariable
constructor
name of the ctx variable we want to assign the return_value of user_proc to.
Constructor Details
#initialize(return_value_step, variable_name:) ⇒ AssignVariable
name of the ctx variable we want to assign the return_value of user_proc to.
23 24 25 26 |
# File 'lib/trailblazer/macro.rb', line 23 def initialize(return_value_step, variable_name:) @return_value_step = return_value_step @variable_name = variable_name end |
Instance Method Details
#call(ctx, flow_options, **circuit_options) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/trailblazer/macro.rb', line 28 def call((ctx, ), **) return_value, ctx = @return_value_step.([ctx, ], **) ctx[@variable_name] = return_value return return_value, ctx end |