Module: Dap::Utils::Misc

Defined in:
lib/dap/utils/misc.rb

Class Method Summary collapse

Class Method Details

.flatten_hash(h) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dap/utils/misc.rb', line 5

def self.flatten_hash(h)
  ret = {}
  h.each_pair do |k,v|
    next unless k
    if v.is_a?(Hash)
      flatten_hash(v).each_pair do |fk,fv|
        ret["#{k}.#{fk}"] = fv.to_s
      end
    else
      ret[k.to_s] = v.to_s
    end
  end
  ret
end