Skip to content

Instantly share code, notes, and snippets.

class Array
def uniq_by(method)
@found = []
self.each do |x|
@found << x unless @found.any?{|y| y.send(method) == x.send(method)}
end
@found
end
end