class Array
def count
k=Hash.new(0)
self.each{|x| k[x]+=1 }
k
end
end
…btw, these types of questions (pure ruby vs ruby on rails) are great
to ask on the ruby forum - that’s what it is for, and the real experts
seem to lay around there (i’ve seen a DHH and even matz shmooze around
there occasionally)
…and, for example, a thread i’ve just found on
the ruby-forum right at this moment -
class Array
def count
k=Hash.new(0)
self.each{|x| k[x]+=1 }
k
end
end
…btw, these types of questions (pure ruby vs ruby on rails) are great
to ask on the ruby forum - that’s what it is for, and the real experts
seem to lay around there (i’ve seen a DHH and even matz shmooze around
there occasionally)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.