class ApacheCrunch::CountBy
DSL routine that returns the count of entries with each found value of the given block
You might for instance run this with the block { status }, and you’d get back something like {“200” => 941, “301” => 41, “404” => 2, “500” => 0}
Public Instance Methods
execute(&blk)
click to toggle source
# File lib/procedure_dsl.rb, line 116 def execute(&blk) counts = {} while @_current_entry = @_log_parser.next_entry val = instance_eval(&blk) if counts.key?(val) counts[val] += 1 else counts[val] = 1 end end return counts end