class DeepStruct
Public Class Methods
new(hash = nil)
click to toggle source
# File lib/ducktrails/utils/deep_struct.rb, line 2 def initialize(hash = nil) @table = {} @hash_table = {} return unless 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
Public Instance Methods
to_h()
click to toggle source
# File lib/ducktrails/utils/deep_struct.rb, line 15 def to_h @hash_table end