class Array
def uniq_with_block
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
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