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.13.2 lib/tins/uniq_by.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/tins-1.13.0/lib/tins/uniq_by.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/tins-1.13.0/lib/tins/uniq_by.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/tins-1.13.0/lib/tins/uniq_by.rb
tins-1.13.0 lib/tins/uniq_by.rb
tdiary-5.0.2 vendor/bundle/gems/tins-1.12.0/lib/tins/uniq_by.rb
tins-1.12.0 lib/tins/uniq_by.rb
tins-1.11.0 lib/tins/uniq_by.rb
tdiary-5.0.1 vendor/bundle/gems/tins-1.10.2/lib/tins/uniq_by.rb
tins-1.10.2 lib/tins/uniq_by.rb
tins-1.10.1 lib/tins/uniq_by.rb
tins-1.10.0 lib/tins/uniq_by.rb
tins-1.9.0 lib/tins/uniq_by.rb
tins-1.8.2 lib/tins/uniq_by.rb
tins-1.8.1 lib/tins/uniq_by.rb
tins-1.8.0 lib/tins/uniq_by.rb
tins-1.7.0 lib/tins/uniq_by.rb
suzuko-0.1.8 vendor/bundle/ruby/2.0.0/gems/tins-1.6.0/lib/tins/uniq_by.rb
suzuko-0.1.7 vendor/bundle/ruby/2.0.0/gems/tins-1.6.0/lib/tins/uniq_by.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/tins-1.6.0/lib/tins/uniq_by.rb