aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Schilling <timo@schilling.io>2019-03-27 21:54:30 +0100
committerTimo Schilling <timo@schilling.io>2019-04-01 17:15:39 +0200
commita805d72e901f81f5b043dfd9904b80ce93ebfc01 (patch)
treeb66f337af990b94262a2fc609d901df2a0270d4a
parent32db884967a8af0409bfcb2158ee948cd7ef619c (diff)
downloadrails-a805d72e901f81f5b043dfd9904b80ce93ebfc01.tar.gz
rails-a805d72e901f81f5b043dfd9904b80ce93ebfc01.tar.bz2
rails-a805d72e901f81f5b043dfd9904b80ce93ebfc01.zip
Speed improvement for HashWithIndifferentAccess#except
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb3
1 files changed, 3 insertions, 0 deletions
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