Class: ApacheCrunch::CountWhere

Inherits:
ProcedureRoutine show all
Defined in:
lib/procedure_dsl.rb

Overview

DSL routine that returns the number of log entries where the block evaluates to true

Instance Method Summary collapse

Methods inherited from ProcedureRoutine

#finish, #initialize, #method_missing

Constructor Details

This class inherits a constructor from ApacheCrunch::ProcedureRoutine

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ApacheCrunch::ProcedureRoutine

Instance Method Details

#execute(&blk) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/procedure_dsl.rb', line 33

def execute(&blk)
    count = 0
    while @_current_entry = @_log_parser.next_entry
        if instance_eval(&blk)
            count += 1
        end
    end
    count
end