All pastes #392546 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-12 22:16 UTC
rendered paste body
module Enumerable
    # Returns amount of objects in collection matching a yielded
    # criteria.
    def count
        t = 0
        each { |i| t += (yield(i)) ? 1 : 0 }
        return t
    end
end