Module: Trailblazer::Activity::DSL::Linear::VariableMapping::DSL

Defined in:
lib/trailblazer/activity/dsl/linear/variable_mapping.rb

Class Method Summary collapse

Class Method Details

.filter_from_dsl(map) ⇒ Object

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



51
52
53
54
55
# File 'lib/trailblazer/activity/dsl/linear/variable_mapping.rb', line 51

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) ⇒ Object



57
58
59
60
# File 'lib/trailblazer/activity/dsl/linear/variable_mapping.rb', line 57

def self.hash_for(ary)
  return ary if ary.instance_of?(::Hash)
  Hash[ary.collect { |name| [name, name] }]
end