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
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/tins-0.13.2/lib/tins/uniq_by.rb
tdiary-5.0.7 vendor/bundle/gems/tins-1.16.3/lib/tins/uniq_by.rb
tins-1.16.3 lib/tins/uniq_by.rb
tins-1.16.2 lib/tins/uniq_by.rb
tins-1.16.1 lib/tins/uniq_by.rb
tins-1.16.0 lib/tins/uniq_by.rb
tins-1.15.1 lib/tins/uniq_by.rb
tdiary-5.0.6 vendor/bundle/gems/tins-1.15.0/lib/tins/uniq_by.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/tins-1.6.0/lib/tins/uniq_by.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/tins-1.6.0/lib/tins/uniq_by.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/tins-1.6.0/lib/tins/uniq_by.rb
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/tins-1.6.0/lib/tins/uniq_by.rb
tins-1.15.0 lib/tins/uniq_by.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/tins-1.13.2/lib/tins/uniq_by.rb
tdiary-5.0.5 vendor/bundle/gems/tins-1.14.0/lib/tins/uniq_by.rb
tdiary-5.0.5 vendor/bundle/gems/tins-1.13.2/lib/tins/uniq_by.rb
tins-1.14.0 lib/tins/uniq_by.rb
tins-1.13.3 lib/tins/uniq_by.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/tins-1.13.2/lib/tins/uniq_by.rb
tdiary-5.0.4 vendor/bundle/gems/tins-1.13.2/lib/tins/uniq_by.rb