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.7.1 lib/tins/uniq_by.rb
tins-0.7.0 lib/tins/uniq_by.rb
tins-0.6.0 lib/tins/uniq_by.rb
tins-0.5.6 lib/tins/uniq_by.rb
tins-0.5.5 lib/tins/uniq_by.rb
tins-0.5.4 lib/tins/uniq_by.rb
tins-0.5.3 lib/tins/uniq_by.rb
tins-0.5.2 lib/tins/uniq_by.rb
tins-0.5.1 lib/tins/uniq_by.rb
tins-0.5.0 lib/tins/uniq_by.rb
tins-0.4.3 lib/tins/uniq_by.rb
tins-0.4.2 lib/tins/uniq_by.rb
tins-0.4.1 lib/tins/uniq_by.rb
tins-0.4.0 lib/tins/uniq_by.rb
tins-0.3.14 lib/tins/uniq_by.rb
tins-0.3.13 lib/tins/uniq_by.rb
tins-0.3.12 lib/tins/uniq_by.rb
tins-0.3.11 lib/tins/uniq_by.rb
tins-0.3.10 lib/tins/uniq_by.rb
tins-0.3.9 lib/tins/uniq_by.rb