Class: ApacheCrunch::ProcedureRoutine
- Inherits:
-
Object
- Object
- ApacheCrunch::ProcedureRoutine
- Defined in:
- lib/procedure_dsl.rb
Overview
Abstract for a procedure routine.
Direct Known Subclasses
ConfidenceInterval, CountBy, CountWhere, Distribution, Each, Filter, LogDistribution, MostCommon, Percentile, Sum
Instance Method Summary collapse
-
#execute(&blk) ⇒ Object
Executes the DSL routine using the given block.
-
#finish ⇒ Object
Anything that needs to happen after the routine completes but before it returns its result can go in here.
-
#initialize(log_parser) ⇒ ProcedureRoutine
constructor
A new instance of ProcedureRoutine.
-
#method_missing(sym, *args) ⇒ Object
Allows blocks passed to a DSL routine to access parameters from the current log entry.
Constructor Details
#initialize(log_parser) ⇒ ProcedureRoutine
6 7 8 9 |
# File 'lib/procedure_dsl.rb', line 6 def initialize(log_parser) @_log_parser = log_parser @_current_entry = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
Allows blocks passed to a DSL routine to access parameters from the current log entry
12 13 14 |
# File 'lib/procedure_dsl.rb', line 12 def method_missing(sym, *args) @_current_entry.fetch(sym) end |
Instance Method Details
#execute(&blk) ⇒ Object
Executes the DSL routine using the given block
Abstract method
19 20 21 |
# File 'lib/procedure_dsl.rb', line 19 def execute(&blk) raise "Not implemented" end |
#finish ⇒ Object
Anything that needs to happen after the routine completes but before it returns its result can go in here.
25 26 27 |
# File 'lib/procedure_dsl.rb', line 25 def finish @_log_parser.reset_file! end |