instance method
stringify_keys
Ruby on Rails 8.1.2
Since v3.0.20Signature
stringify_keys()
Returns a new hash with all keys converted to strings.
hash = { name: 'Rob', age: '28' } hash.stringify_keys # => {"name"=>"Rob", "age"=>"28"}
Source
# 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
Defined in activesupport/lib/active_support/core_ext/hash/keys.rb line 10
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Hash