Permalink
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...
2 parents 692b64e + f6bedc9 commit 3dc753fa51fef19663b3d666211cdaccd5de010f @carlosantoniodasilva carlosantoniodasilva committed Jun 28, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 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

0 comments on commit 3dc753f

Please sign in to comment.