Module: HTTParty::Utils

Defined in:
lib/httparty/utils.rb

Class Method Summary collapse

Class Method Details

.stringify_keys(hash) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/httparty/utils.rb', line 5

def self.stringify_keys(hash)
  return hash.transform_keys(&:to_s) if hash.respond_to?(:transform_keys)

  hash.each_with_object({}) do |(key, value), new_hash|
    new_hash[key.to_s] = value
  end
end