Module: Trailblazer::Activity::TaskWrap::VariableMapping

Defined in:
lib/trailblazer/activity/task_wrap/variable_mapping.rb

Overview

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.

Class Method Summary collapse

Class Method Details

.Extension(input, output, id: input.object_id) ⇒ Object

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



11
12
13
14
15
# 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:) ⇒ Object

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



18
19
20
21
22
23
# 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