Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/compatibility.rb

Instance Method Summary collapse

Instance Method Details

#remove(*keys) ⇒ Object

non-destructive version



16
17
18
# File 'lib/compatibility.rb', line 16

def remove(*keys)
  self.dup.remove!(*keys)
end

#remove!(*keys) ⇒ Object

pass single or array of keys, which will be removed, returning the remaining hash



10
11
12
13
# File 'lib/compatibility.rb', line 10

def remove!(*keys)
  keys.each{|key| self.delete(key) }
  self
end