class Array

Public Instance Methods

hashify_with_counts() click to toggle source
# 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