From 32db884967a8af0409bfcb2158ee948cd7ef619c Mon Sep 17 00:00:00 2001 From: Timo Schilling Date: Wed, 27 Mar 2019 21:18:18 +0100 Subject: Speed improvement for Hash#except --- activesupport/lib/active_support/core_ext/hash/except.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/hash/except.rb b/activesupport/lib/active_support/core_ext/hash/except.rb index 6258610c98..5013812460 100644 --- a/activesupport/lib/active_support/core_ext/hash/except.rb +++ b/activesupport/lib/active_support/core_ext/hash/except.rb @@ -10,7 +10,7 @@ class Hash # This is useful for limiting a set of parameters to everything but a few known toggles: # @person.update(params[:person].except(:admin)) def except(*keys) - dup.except!(*keys) + slice(*self.keys - keys) end # Removes the given keys from hash and returns it. -- cgit v1.2.3