Module: HashHelper
- Included in:
- Hash
- Defined in:
- lib/rubyhelper/hash.rb
Instance Method Summary collapse
-
#except(*keys) ⇒ Hash
Return a hash that includes everything but the given keys.
-
#except!(*keys) ⇒ Hash
Replaces the hash without the given keys.
Instance Method Details
#except(*keys) ⇒ Hash
Return a hash that includes everything but the given keys.
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.
13 14 15 16 |
# File 'lib/rubyhelper/hash.rb', line 13 def except!(*keys) keys.each { |key| self.delete(key) } return self end |