From a805d72e901f81f5b043dfd9904b80ce93ebfc01 Mon Sep 17 00:00:00 2001 From: Timo Schilling Date: Wed, 27 Mar 2019 21:54:30 +0100 Subject: Speed improvement for HashWithIndifferentAccess#except --- activesupport/lib/active_support/hash_with_indifferent_access.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index 3a2b2652c4..a4e366f80f 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -293,6 +293,9 @@ module ActiveSupport super(convert_key(key)) end + def except(*keys) + slice(*self.keys - keys.map { |key| convert_key(key) }) + end alias_method :without, :except def stringify_keys!; self end -- cgit v1.2.3