module Tins::UniqBy
Public Instance Methods
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
# 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