Sha256: cf4552a0e2ef78a8d3c295beff77d20ee38d72660801dc362364c4d6ea0745c7

Contents?: true

Size: 164 Bytes

Versions: 8

Compression:

Stored size: 164 Bytes

Contents

class Array
  def hashify_with_counts
    hash = {}
    self.each do |item|
      hash[item] = hash.has_key?(item) ? (hash[item] + 1) : 1
    end
    hash
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
omnicat-0.3.0 lib/omnicat/array.rb
omnicat-0.2.2 lib/omnicat/array.rb
omnicat-0.2.1 lib/omnicat/array.rb
omnicat-0.2.0 lib/omnicat/array.rb
omnicat-0.1.3 lib/omnicat/array.rb
omnicat-0.1.2 lib/omnicat/array.rb
omnicat-0.1.1 lib/omnicat/array.rb
omnicat-0.1.0 lib/omnicat/array.rb