Method: EasyTalk::Model::InstanceMethods#initialize

Defined in:
lib/easy_talk/model.rb

#initialize(attributes = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/easy_talk/model.rb', line 50

def initialize(attributes = {})
  @additional_properties = {}
  provided_keys = attributes.keys.to_set(&:to_sym)

  super # Perform initial mass assignment

  schema_def = self.class.schema_definition
  return unless schema_def.respond_to?(:schema) && schema_def.schema.is_a?(Hash)

  (schema_def.schema[:properties] || {}).each do |prop_name, prop_definition|
    process_property_initialization(prop_name, prop_definition, provided_keys)
  end
end