Feature #11076
Updated by nobu (Nobuyoshi Nakada) over 9 years ago
I very often use `Hash[array.group_by{|x|x}.map{|x,y|[x,y.size]}]`. Would be nice with to have a method called `count_by`: ~~~ruby array = ['aa', 'aA', 'bb', 'cc'] p array.count_by(&:downcase) #=> {'aa'=>2,'bb'=>1,'cc'=>1} ~~~