Module: Aliyun::Utils

Defined in:
lib/aliyun/utils.rb

Class Method Summary collapse

Class Method Details

.symbolize_hash_keys(object) ⇒ Object



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

def symbolize_hash_keys(object)
  if object.is_a? Hash
    object.keys.each { |k| object[(k.to_sym rescue k) || k] = symbolize_hash_keys(object.delete(k)) }
  elsif object.is_a? Array
    object.each { |e| symbolize_hash_keys(e) }
  end
  object
end