Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/omnicat/array.rb

Instance Method Summary collapse

Instance Method Details

#hashify_with_countsObject



2
3
4
5
6
7
8
# File 'lib/omnicat/array.rb', line 2

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