Class: Facy::DeepStruct
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Facy::DeepStruct
- Defined in:
- lib/facy/converter.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(hash = nil) ⇒ DeepStruct
constructor
A new instance of DeepStruct.
- #to_h ⇒ Object
Constructor Details
#initialize(hash = nil) ⇒ DeepStruct
Returns a new instance of DeepStruct.
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/facy/converter.rb', line 74 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 |
Instance Method Details
#to_h ⇒ Object
87 88 89 |
# File 'lib/facy/converter.rb', line 87 def to_h @hash_table end |