Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 16 lines (14 sloc) 0.394 kB
b4a1718 @jeremy Convert hash extension modules to class reopens
jeremy authored
1 class Hash
2 # Return a hash that includes everything but the given keys. This is useful for
3 # limiting a set of parameters to everything but a few known toggles:
4 #
1bb0200 Change docs to use update instead of update_attributes
Amparo Luna + Guillermo Iguaran authored
5 # @person.update(params[:person].except(:admin))
b4a1718 @jeremy Convert hash extension modules to class reopens
jeremy authored
6 def except(*keys)
7 dup.except!(*keys)
8 end
cb23816 @dhh Added Hash#except which is the inverse of Hash#slice -- return the ha…
dhh authored
9
b4a1718 @jeremy Convert hash extension modules to class reopens
jeremy authored
10 # Replaces the hash without the given keys.
11 def except!(*keys)
12 keys.each { |key| delete(key) }
13 self
cb23816 @dhh Added Hash#except which is the inverse of Hash#slice -- return the ha…
dhh authored
14 end
15 end
Something went wrong with that request. Please try again.