Class: ObjectFlatten

Inherits:
Object
  • Object
show all
Defined in:
lib/object_flatten.rb,
lib/object_flatten/version.rb,
lib/object_flatten/object_flatten.rb

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.flatten(obj, sep = '.') ⇒ Object



3
4
5
6
7
8
9
# File 'lib/object_flatten/object_flatten.rb', line 3

def flatten(obj, sep = '.')
  unless obj.is_a?(Hash)
    raise TypeError, "TypeError: wrong argument type #{obj.class} (expected Hash)"
  end

  flatten0(nil, obj, sep.to_s)
end