From: Tom Sawyer Date: 2002-07-13T21:53:32+09:00 Subject: Re: hey! where's #count? indeed, i used select. i was just sort of surprised that #count wasn't in Enumberable. #include? is there, as is #select --what you suggest to use to do the count. ~transami On Sat, 2002-07-13 at 06:05, MoonWolf wrote: > > i went to count the number of equal objects in an array and discoverd > > there was no #count. that was odd, i thought, there's one for string. > > but then it occured to me, #count would be in Enumberable. but no. it is > > not. hey! why not? > > use Enumerable#select > > obj.select {|item| item==str}.size > > or > > count=0 > obj.each {|item| count += 1 if item==str} > count > > -- > MoonWolf > > > -- ~transami __("< berk! berk! \__/ ^^