Class: Hash

Inherits:
Object show all
Defined in:
lib/utility_belt/hash_math.rb

Instance Method Summary collapse

Instance Method Details

#-(thing_to_be_deleted) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/utility_belt/hash_math.rb', line 3

def -(thing_to_be_deleted)
  if thing_to_be_deleted.is_a? Hash
    thing_to_be_deleted.each do |key, value|
      self.delete(key) if self[key] == value
    end
  elsif self.keys.include? thing_to_be_deleted
    self.delete(thing_to_be_deleted)
  end
  self
end