diff options
author | Grant Hutchins <nertzy@gmail.com> | 2012-06-27 20:09:30 -0400 |
---|---|---|
committer | Grant Hutchins <nertzy@gmail.com> | 2012-06-27 20:09:30 -0400 |
commit | f6bedc960dfbd2a5262d65c69fb51789b060643e (patch) | |
tree | b1ea543fd1b26687320c51c0fdf528ca941ab3d8 | |
parent | 692b64e3ac9191abf03578e803f39905d90437ed (diff) | |
download | rails-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
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/keys.rb | 2 |
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 |