Speed improvement for Hash#except

This commit is contained in:
Timo Schilling 2019-03-27 21:18:18 +01:00
parent e3f5f1c936
commit 32db884967
No known key found for this signature in database
GPG Key ID: A61AC87FD0E52407
1 changed files with 1 additions and 1 deletions

View File

@ -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.