Class: OpenStructDeep
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- OpenStructDeep
- Defined in:
- lib/open_struct_deep.rb
Instance Method Summary collapse
-
#initialize(hash = nil) ⇒ OpenStructDeep
constructor
A new instance of OpenStructDeep.
Constructor Details
#initialize(hash = nil) ⇒ OpenStructDeep
Returns a new instance of OpenStructDeep.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/open_struct_deep.rb', line 5 def initialize(hash=nil) @table = {} if hash hash.each_pair do |k, v| k = k.to_sym v = OpenStructDeep.new v if v.is_a? Hash v = v.map { |x| OpenStructDeep.new x } if v.is_a? Array @table[k] = v end end end |