1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make Enumerable.pluck faster for single key

This commit is contained in:
Alexey Savin 2020-08-06 21:22:20 +03:00
parent ab0e39c231
commit 80f59eadb4

View file

@ -153,7 +153,8 @@ module Enumerable
if keys.many?
map { |element| keys.map { |key| element[key] } }
else
map { |element| element[keys.first] }
key = keys.first
map { |element| element[key] }
end
end