PageRenderTime 21ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/extensions/flyrb/lib/flyrb/hash_math.rb

http://github.com/alloy/dietrb
Ruby | 13 lines | 13 code | 0 blank | 0 comment | 3 complexity | 84de8aa378e0b72f8cf23636b60bd0d0 MD5 | raw file
 1class Hash
 2  alias :+ :merge
 3  def -(thing_to_be_deleted)
 4    if thing_to_be_deleted.is_a? Hash
 5      thing_to_be_deleted.each do |key, value|
 6        self.delete(key) if self[key] == value
 7      end
 8    elsif self.keys.include? thing_to_be_deleted
 9      self.delete(thing_to_be_deleted)
10    end
11    self
12  end
13end