aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/hash/keys.rb
diff options
context:
space:
mode:
authorGrant Hutchins <nertzy@gmail.com>2012-06-27 20:09:30 -0400
committerGrant Hutchins <nertzy@gmail.com>2012-06-27 20:09:30 -0400
commitf6bedc960dfbd2a5262d65c69fb51789b060643e (patch)
treeb1ea543fd1b26687320c51c0fdf528ca941ab3d8 /activesupport/lib/active_support/core_ext/hash/keys.rb
parent692b64e3ac9191abf03578e803f39905d90437ed (diff)
downloadrails-f6bedc960dfbd2a5262d65c69fb51789b060643e.tar.gz
rails-f6bedc960dfbd2a5262d65c69fb51789b060643e.tar.bz2
rails-f6bedc960dfbd2a5262d65c69fb51789b060643e.zip
Speed up Hash#transform_keys using Hash#each_key
See https://gist.github.com/3007749 for justification
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash/keys.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/keys.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/keys.rb b/activesupport/lib/active_support/core_ext/hash/keys.rb
index 8e728691c6..e753e36124 100644
--- a/activesupport/lib/active_support/core_ext/hash/keys.rb
+++ b/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