class PIM::MappingExporter::MappingFunctionContext

Public Instance Methods

c() click to toggle source

For compatibility in ‘execute_ruby_code’ mapping function. simply return ‘self’.

# File mapping-exporter.rb, line 24
def c
  self
end
custom_value(name)
custom_values()
exec(mapping_function_name, mapping_function_params = {})
exec_function(mapping_function_name, mapping_function_params = {})
exec_mapping_function(mapping_function_name, mapping_function_params = {}) click to toggle source
# File mapping-exporter.rb, line 57
def exec_mapping_function mapping_function_name, mapping_function_params = {}

  mapping_function = data_module.mapping_function(mapping_function_name)
  if mapping_function.nil?

    # Mapping function not found
    raise "Mapping function '#{mapping_function_name}' not found"

  end

  # Convert the mapping parameters
  converted_param_values = mapping_function.convert_parameter_values(mapping_function_params)

  # Create a copy of the context and call the function
  mapping_context = self.dup
  mapping_context[:parameter_values] = converted_param_values
  result = mapping_function.execute(mapping_context)

  return result

end
Also aliased as: exec_function, exec
item_value(name) click to toggle source
# File mapping-exporter.rb, line 39
def item_value name
  PIM.get_value(item, name)
end
mapped_value(name) click to toggle source
# File mapping-exporter.rb, line 53
def mapped_value name
  PIM.get_value(:mapped_values, name)
end
mapping_custom_value(name) click to toggle source
# File mapping-exporter.rb, line 48
def mapping_custom_value name
  PIM.get_value(mapping_custom_values, name)
end
Also aliased as: custom_value
mapping_custom_values() click to toggle source
# File mapping-exporter.rb, line 43
def mapping_custom_values
  PIM.get_value(self.mapping, :custom_values)
end
Also aliased as: custom_values
param(name)
Alias for: parameter_value
param_default(name)
Alias for: parameter_default
param_value(name)
Alias for: parameter_value
parameter_default(name) click to toggle source
# File mapping-exporter.rb, line 34
def parameter_default name
  mapping_function.parameter_default(name) if mapping_function
end
Also aliased as: param_default
parameter_value(name) click to toggle source
# File mapping-exporter.rb, line 28
def parameter_value name
  PIM.get_value(self.parameter_values, name) || parameter_default(name)
end
Also aliased as: param_value, param