From: Dominik Honnef Date: 2011-04-16T19:34:13+09:00 Subject: Re: how to count values in an array using 1.8.6 ? Richard Sandoval writes: > Hi, > > How can I count all keys in an array? > > For instance, I want to do this > >>> countme = [1,2,3,4,4,4,4,4,5] > => [1, 2, 3, 4, 4, 4, 4, 4, 5] >>> countme.count > => 9 > > but in ruby 1.8.6, there is only size which doesn't quite work... I can't quite see what the problem is here. In 1.9.x, Array#{length,size,count} are synonymous, and 1.8.6 is just missing the last of those, #count. #length and #size still behave the exact same and return 9 for your example array.