class PIM::MappingFunction
Constants
- PARAM_TYPES
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
PIM::BuildingObject::new
# File pim.rb, line 10741 def initialize *args super check_non_empty :name end
Public Instance Methods
convert_parameter_values(param_values)
click to toggle source
# File pim.rb, line 10746 def convert_parameter_values param_values converted_values = {} unless @parameters.nil? @parameters.each do |parameter| param_value = PIM.get_value(param_values, parameter.name) converted_values[parameter.name] = parameter.convert_value(param_value) end end converted_values end
Also aliased as: convert_param_values
execute(context)
click to toggle source
# File pim.rb, line 10770 def execute context begin result = @code.call(context) result = MappingFunctionUtil.convert_value(result, @type) return result rescue Exception => e PIM.log_error("Could not execute mapping function #{name}", e) return "[ERROR] '#{e.class}' in mapping function #{name}: #{e.message}" end end
Also aliased as: exec
parameter(name)
click to toggle source
# File pim.rb, line 10758 def parameter name name = PIM.to_sym(name) parameter = @parameters.find { |p| p.name == name } end
Also aliased as: param
parameter_default(name)
click to toggle source
# File pim.rb, line 10764 def parameter_default name parameter = parameter(name) return parameter.default_value if parameter end
Also aliased as: param_default