Class: InformanteObject

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/informante/informante_object.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = nil) ⇒ InformanteObject

Returns a new instance of InformanteObject.



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/informante/informante_object.rb', line 2

def initialize(hash=nil)
  @table = {}
  @hash_table = {}

  if hash
    hash.each do |k,v|
      @table[k.to_sym] = (v.is_a?(Hash) ? self.class.new(v) : v)
      @hash_table[k.to_sym] = v

      new_ostruct_member(k)
    end
  end
end