module Trailblazer::Activity::DSL::Linear::VariableMapping::DSL

Public Class Methods

filter_from_dsl(map) click to toggle source

The returned filter compiles a new hash for Scoped/Unscoped that only contains the desired i/o variables.

# File lib/trailblazer/activity/dsl/linear/variable_mapping.rb, line 65
def self.filter_from_dsl(map)
  hsh = DSL.hash_for(map)

  ->(incoming_ctx, **kwargs) { Hash[hsh.collect { |from_name, to_name| [to_name, incoming_ctx[from_name]] }] }
end
hash_for(ary) click to toggle source
# File lib/trailblazer/activity/dsl/linear/variable_mapping.rb, line 71
def self.hash_for(ary)
  return ary if ary.instance_of?(::Hash)
  Hash[ary.collect { |name| [name, name] }]
end