Class: Hash

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

Overview

in lib/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#remove(*keys) ⇒ Object

non-destructive version



17
18
19
# File 'lib/core_extensions.rb', line 17

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



11
12
13
14
# File 'lib/core_extensions.rb', line 11

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