Module: Specular::Support

Defined in:
lib/specular/support.rb

Class Method Summary collapse

Class Method Details

.stringify_keys(obj) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/specular/support.rb', line 2

def self.stringify_keys(obj)
  case (obj)
  when Hash
    obj.to_h do |k, v|
      [
        k.to_s,
        stringify_keys(v)
      ]
    end
  when Array
    obj.map do |v|
      stringify_keys(v)
    end
  else
    obj
  end
end