Module: HashHelper

Included in:
Hash
Defined in:
lib/rubyhelper/hashhelper.rb

Instance Method Summary collapse

Instance Method Details

#except(*keys) ⇒ Object

Return a hash that includes everything but the given keys.



3
4
5
# File 'lib/rubyhelper/hashhelper.rb', line 3

def except(*keys)
  return self.dup.except!(*keys)
end

#except!(*keys) ⇒ Object

Replaces the hash without the given keys.



8
9
10
11
# File 'lib/rubyhelper/hashhelper.rb', line 8

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