Top Level Namespace

Defined Under Namespace

Modules: SilverlineAPI

Instance Method Summary collapse

Instance Method Details

#symbolize_keys(arg) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/librato_silverline_api.rb', line 7

def symbolize_keys(arg)
  case arg
  when Array
    arg.map { |elem| symbolize_keys elem }
  when Hash
    Hash[
      arg.map do |key, value|  
        k = key.is_a?(String) ? key.to_sym : key
        v = symbolize_keys(value)
        [k,v]
      end
    ]
  else
    arg
  end
end