module PIM::BuildingObject

Constants

BUILDER_CLASS_NAME
BUILD_PARAMETERS_VAR

Public Class Methods

new(args = {}) click to toggle source
# File pim.rb, line 3183
def initialize args = {}

  raise "Please define '#{BUILD_PARAMETERS_VAR}' constant!" unless self.class.const_defined?(BUILD_PARAMETERS_VAR)

  variables = self.class.const_get(BUILD_PARAMETERS_VAR) || []
  variables.each do |var|
    self.instance_variable_set(to_instance_variable_name(var), args[var])
  end

end

Public Instance Methods

as_json() click to toggle source
# File pim.rb, line 3194
def as_json
  json = {}
  variables = self.class.const_get(BUILD_PARAMETERS_VAR) || []
  variables.each do |var|
    value = self.instance_variable_get(to_instance_variable_name(var))
    next if value.nil? or Utils.is_proc?(value)
    value = Utils.as_json(value)
    key = camelize(var)
    json[key] = value
  end
  json
end