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.3.0 lib/tins/uniq_by.rb
tins-1.2.0 lib/tins/uniq_by.rb
tins-1.1.0 lib/tins/uniq_by.rb
tins-1.0.1 lib/tins/uniq_by.rb
tins-1.0.0 lib/tins/uniq_by.rb
tins-0.13.2 lib/tins/uniq_by.rb
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/tins-0.13.1/lib/tins/uniq_by.rb
tins-0.13.1 lib/tins/uniq_by.rb
tins-0.13.0 lib/tins/uniq_by.rb
tins-0.12.0 lib/tins/uniq_by.rb
tins-0.11.0 lib/tins/uniq_by.rb
tins-0.10.0 lib/tins/uniq_by.rb
tins-0.9.0 lib/tins/uniq_by.rb
tins-0.8.4 lib/tins/uniq_by.rb
tins-0.8.3 lib/tins/uniq_by.rb
tins-0.8.2 lib/tins/uniq_by.rb
tins-0.8.0 lib/tins/uniq_by.rb
tins-0.7.4 lib/tins/uniq_by.rb
tins-0.7.3 lib/tins/uniq_by.rb
tins-0.7.2 lib/tins/uniq_by.rb