From 49598c0638b8f8afeb10b20cf64ff83a2ea1d8b2 Mon Sep 17 00:00:00 2001 From: Timo Schilling Date: Tue, 2 Apr 2019 11:48:39 +0200 Subject: Speed improvement for HashWithIndifferentAccess#values_at --- activesupport/lib/active_support/hash_with_indifferent_access.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index e0117dacfc..42ae7e9b7b 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -225,8 +225,8 @@ module ActiveSupport # hash[:a] = 'x' # hash[:b] = 'y' # hash.values_at('a', 'b') # => ["x", "y"] - def values_at(*indices) - indices.collect { |key| self[convert_key(key)] } + def values_at(*keys) + super(*keys.map { |key| convert_key(key) }) end # Returns an array of the values at the specified indices, but also -- cgit v1.2.3