Delete Non-unique Hash Values in Ruby Jan 12th, 2013 1 2 3 4 h = {:cat => "cat", :dog => "dog", :fish => "dog"} arr = Array.new h.each{|key, val| arr.include?(val) ? h.delete(key) : arr « val } => {:cat=>"cat", :dog=>"dog"}