Class: Constancy::Util

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

Class Method Summary collapse

Class Method Details

.flatten_hash(h, f = [], g = {}) ⇒ Object



38
39
40
41
42
# File 'lib/constancy.rb', line 38

def flatten_hash(h,f=[],g={})
  return g.update({ f=>h }) unless h.is_a? Hash
  h.each { |k,r| flatten_hash(r,f+[k],g) }
  g
end