Class: Andy::NestedOStruct

Inherits:
Object
  • Object
show all
Defined in:
lib/andy/nested_ostruct.rb

Class Method Summary collapse

Class Method Details

.new(hash) ⇒ Object



5
6
7
8
# File 'lib/andy/nested_ostruct.rb', line 5

def self.new(hash)
  OpenStruct.new(hash.inject({}){|r,p| r[p[0]] = p[1].kind_of?(Hash)?
  Andy::NestedOStruct.new(p[1]) : p[1]; r })
end