# File lib/backports/1.9.2/array/uniq.rb, line 5 def uniq_with_block return uniq_without_block unless block_given? h = {} each do |elem| key = yield(elem) h[key] = elem unless h.has_key?(key) end h.values end