mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Speed up Hash#transform_keys using Hash#each_key
See https://gist.github.com/3007749 for justification
This commit is contained in:
parent
692b64e3ac
commit
f6bedc960d
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue