Sha256: fd9c864c84776d0269970568168f895293aa90dad655d25c61b3eff06ac15b71

Contents?: true

Size: 169 Bytes

Versions: 169

Compression:

Stored size: 169 Bytes

Contents

module Tins
  module UniqBy
    def uniq_by(&b)
      b ||= lambda { |x| x }
      inject({}) { |h, e| h[b[e]] ||= e; h }.values
    end
  end
end

require 'tins/alias'

Version data entries

169 entries across 151 versions & 9 rubygems

Version Path
tins-0.3.8 lib/tins/uniq_by.rb
tins-0.3.7 lib/tins/uniq_by.rb
tins-0.3.6 lib/tins/uniq_by.rb
tins-0.3.5 lib/tins/uniq_by.rb
tins-0.3.4 lib/tins/uniq_by.rb
tins-0.3.3 lib/tins/uniq_by.rb
tins-0.3.2 lib/tins/uniq_by.rb
tins-0.3.1 lib/tins/uniq_by.rb
tins-0.3.0 lib/tins/uniq_by.rb