Method: PoolParty::Schema#initialize

Defined in:
lib/poolparty/schema.rb

#initialize(h = {}) ⇒ Schema

Returns a new instance of Schema.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/poolparty/schema.rb', line 9

def initialize(h={})
  @hsh = {}
  case h
  when Hash
    h.each {|k,v| self[k] = v}
  when Array
    h.each {|el| self[el['ip']]=el}
  when String        
    JSON.parse(h).each {|k,v| self[k.to_sym] = v}
  end
end