Module: HashHelper

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

Instance Method Summary collapse

Instance Method Details

#except(*keys) ⇒ Hash

Return a hash that includes everything but the given keys.

Returns:



6
7
8
# File 'lib/rubyhelper/hash.rb', line 6

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

#except!(*keys) ⇒ Hash

Replaces the hash without the given keys.

Returns:



13
14
15
16
# File 'lib/rubyhelper/hash.rb', line 13

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