Method: Hash#stringify_keys

Defined in:
activesupport/lib/active_support/core_ext/hash/keys.rb

#stringify_keysObject

Returns a new hash with all keys converted to strings.

hash = { name: 'Rob', age: '28' }

hash.stringify_keys
# => {"name"=>"Rob", "age"=>"28"}


10
11
12
# File 'activesupport/lib/active_support/core_ext/hash/keys.rb', line 10

def stringify_keys
  transform_keys { |k| Symbol === k ? k.name : k.to_s }
end