Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6886 from nertzy/faster_stringify_and_symbolize_keys

Speed up Hash#transform_keys using Hash#each_key
  • Loading branch information...
commit 3dc753fa51fef19663b3d666211cdaccd5de010f 2 parents 692b64e + f6bedc9
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activesupport/lib/active_support/core_ext/hash/keys.rb
View
2  activesupport/lib/active_support/core_ext/hash/keys.rb
@@ -7,7 +7,7 @@ class Hash
# # => { "NAME" => "Rob", "AGE" => "28" }
def transform_keys
result = {}
- keys.each do |key|
+ each_key do |key|
result[yield(key)] = self[key]
end
result
Please sign in to comment.
Something went wrong with that request. Please try again.