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-1.29.1 lib/tins/uniq_by.rb
tins-1.29.0 lib/tins/uniq_by.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/lib/tins/uniq_by.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/uniq_by.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/lib/tins/uniq_by.rb
tins-1.28.0 lib/tins/uniq_by.rb
tins-1.27.1 lib/tins/uniq_by.rb
tins-1.27.0 lib/tins/uniq_by.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/uniq_by.rb
tins-1.26.0 lib/tins/uniq_by.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/tins-1.25.0/lib/tins/uniq_by.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/tins-1.25.0/lib/tins/uniq_by.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/tins-1.25.0/lib/tins/uniq_by.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/lib/tins/uniq_by.rb
tins-1.25.0 lib/tins/uniq_by.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/lib/tins/uniq_by.rb
tdiary-5.1.1 vendor/bundle/ruby/2.7.0/gems/tins-1.24.1/lib/tins/uniq_by.rb
tins-1.24.1 lib/tins/uniq_by.rb
tins-1.24.0 lib/tins/uniq_by.rb
tins-1.23.0 lib/tins/uniq_by.rb