module PIM::MappingFunctions

Public Instance Methods

all_mapping_functions() click to toggle source
# File pim.rb, line 10814
def all_mapping_functions
  mapping_functions = {}
  mapping_functions.merge!(@module_mapping_functions) if @module_mapping_functions
  add_parent_objects(mapping_functions) { |p| p.module_mapping_functions }
  mapping_functions
end
mapping_function(name, type = nil, label = nil, &block) click to toggle source
# File pim.rb, line 10787
def mapping_function name, type = nil, label = nil, &block

  name = to_sym(name)
  if type or block

    if module_mapping_functions.has_key? name
      if not data_module.has_option?(:ignore_defined_mapping_functions)
        raise "Mapping function with name '#{name}' is already defined in data model #{self}"
      else
        return module_mapping_functions[name]
      end
    end

    builder = PIM::MappingFunction.builder(data_module)
    mapping_function = builder.build(name, type, label, &block)
    module_mapping_functions[name] = mapping_function

    mapping_function

  elsif name.is_a? PIM::MappingFunction
    name
  else
    all_mapping_functions[name]
  end

end
mapping_functions_as_json() click to toggle source
# File pim.rb, line 10825
def mapping_functions_as_json
  as_json(Hash[all_mapping_functions().sort])
end
module_mapping_functions() click to toggle source
# File pim.rb, line 10821
def module_mapping_functions
  @module_mapping_functions ||= {}
end