Module: HTTParty::Utils

Defined in:
lib/httparty/utils.rb

Class Method Summary collapse

Class Method Details

.stringify_keys(hash) ⇒ Object


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

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