Method: Hash#remove!

Defined in:
lib/core/facets/hash/except.rb

#remove!(*rejected) ⇒ Object

Replaces hash with new hash less the given keys. This returns the hash of keys removed.

h = {:a=>1, :b=>2, :c=>3}
h.except!(:a)  #=> {:a=>1}
h              #=> {:b=>2,:c=>3}

Returns a Hash of the removed pairs.


30
31
32
33
34
# File 'lib/core/facets/hash/except.rb', line 30

def remove!(*rejected)
  removed = {}
  rejected.each{ |k| removed[k] = delete(k) }
  removed
end