module Trailblazer::Activity::TaskWrap::VariableMapping

Creates taskWrap steps to map variables before and after the actual step. We hook into the Normalizer, process `:input` and `:output` directives and translate them into a {DSL::Extension}.

Note that the two options are not the only way to create filters, you can use the more low-level {Scoped()} etc., too, and write your own filter logic.

Public Class Methods

Extension(input, output, id: input.object_id) click to toggle source

The taskWrap extension that's included into the static taskWrap for a task.

# File lib/trailblazer/activity/task_wrap/variable_mapping.rb, line 11
def self.Extension(input, output, id: input.object_id)
  Trailblazer::Activity::TaskWrap::Extension(
    merge: merge_for(input, output, id: id),
  )
end
merge_for(input, output, id:) click to toggle source

DISCUSS: do we want the automatic wrapping of {input} and {output}?

# File lib/trailblazer/activity/task_wrap/variable_mapping.rb, line 18
def self.merge_for(input, output, id:) # TODO: rename
  [
    [TaskWrap::Pipeline.method(:insert_before), "task_wrap.call_task", ["task_wrap.input", TaskWrap::Input.new(input, id: id)]],
    [TaskWrap::Pipeline.method(:insert_after),  "task_wrap.call_task", ["task_wrap.output", TaskWrap::Output.new(output, id: id)]],
  ]
end