Module: Summon::Schema::Initializer

Defined in:
lib/summon/schema.rb

Instance Method Summary collapse

Instance Method Details

#new(service, values = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/summon/schema.rb', line 16

def new(service, values = {})
  dup = {}
  for k, v in values
    dup[k.to_s] = v
  end
  instance = allocate
  instance.instance_eval do
    @src = values
    @service = service
  end
  for attribute in @attrs
    instance.instance_variable_set("@#{attribute.name}", attribute.get(service, dup))
  end        
  instance
end