Class: Trailblazer::Activity::DSL::Linear::VariableMapping::Pipe::Output

Inherits:
Input
  • Object
show all
Defined in:
lib/trailblazer/activity/dsl/linear/feature/variable_mapping/runtime.rb

Overview

API in VariableMapping::Output:

output_ctx = @filter.(returned_ctx, [original_ctx, returned_flow_options], **original_circuit_options)

Returns output_ctx that is used after taskWrap finished.

Instance Method Summary collapse

Methods inherited from Input

#initialize

Constructor Details

This class inherits a constructor from Trailblazer::Activity::DSL::Linear::VariableMapping::Pipe::Input

Instance Method Details

#call(wrap_ctx, original_args) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/trailblazer/activity/dsl/linear/feature/variable_mapping/runtime.rb', line 36

def call(wrap_ctx, original_args)
  returned_ctx, returned_flow_options = wrap_ctx[:return_args]  # this is the Context returned from {call}ing the wrapped user task.
  original_ctx                        = wrap_ctx[@id]           # grab the original ctx from before which was set in the {:input} filter.
  _, original_circuit_options         = original_args

  # let user compute the output.
  pipe_ctx, _     = @pipe.({original_ctx: original_ctx, returned_ctx: returned_ctx, aggregate: {}}, [[original_ctx, returned_flow_options], original_circuit_options])
  ctx_from_output = pipe_ctx[:aggregate]

  wrap_ctx = wrap_ctx.merge(return_args: [ctx_from_output, returned_flow_options]) # DISCUSS: this won't allow tracing in the taskWrap as we're returning {returned_flow_options} from above.

  return wrap_ctx, original_args
end