Class: ApacheCrunch::Sum

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

Overview

DSL routine that calculates the sum of the quantities given by the block

All values produced by the block must have a to_f method, and this routine returns a float.

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



60
61
62
63
64
65
66
67
# File 'lib/procedure_dsl.rb', line 60

def execute(&blk)
    rslt = 0.0
    while @_current_entry = @_log_parser.next_entry
        rslt += instance_eval(&blk).to_f
    end

    rslt
end