module Tins::UniqBy

Public Instance Methods

uniq_by(&block) click to toggle source
# File lib/tins/uniq_by.rb, line 6
def uniq_by(&block)
  block ||= lambda { |x| x }
  inject({}) { |h, e| h[ block.call(e) ] ||= e; h }.values
end