2 3 4
# File 'lib/trax/core/ext/enumerable.rb', line 2 def group_by_count ::Hash.new(0).tap{|hash| each{|item| hash[item] += 1 } } end