Class: ApacheCrunch::ProcedureEnvironment
- Inherits:
-
Object
- Object
- ApacheCrunch::ProcedureEnvironment
- Defined in:
- lib/procedure_dsl.rb
Overview
The environment in which a procedure file is evaluated.
A procedure file is some ruby code that uses our DSL.
Instance Method Summary collapse
-
#confidence_interval(confidence, &blk) ⇒ Object
DSL routine ‘confidence_interval’.
-
#count_by(&blk) ⇒ Object
DSL routine ‘count_by’.
-
#count_where(&blk) ⇒ Object
DSL routine ‘count_where’.
-
#distribution(bucket_width, &blk) ⇒ Object
DSL routine ‘distribution’.
-
#each(&blk) ⇒ Object
DSL routine ‘each’.
-
#eval_procedure(proc_string) ⇒ Object
Evaluates the given string as a procedure in our DSL.
-
#filter(target_path = nil, &blk) ⇒ Object
DSL routine ‘filter’.
-
#filter!(&blk) ⇒ Object
DSL routine ‘filter!’.
-
#initialize(log_parser) ⇒ ProcedureEnvironment
constructor
A new instance of ProcedureEnvironment.
-
#log_distribution(width_base, &blk) ⇒ Object
DSL routine ‘log_distribution’.
-
#most_common(n, &blk) ⇒ Object
DSL routine ‘most_common’.
-
#percentile(n, &blk) ⇒ Object
DSL routine ‘percentile’.
-
#sum(&blk) ⇒ Object
DSL routine ‘sum’.
Constructor Details
#initialize(log_parser) ⇒ ProcedureEnvironment
276 277 278 |
# File 'lib/procedure_dsl.rb', line 276 def initialize(log_parser) @_log_parser = log_parser end |
Instance Method Details
#confidence_interval(confidence, &blk) ⇒ Object
DSL routine ‘confidence_interval’
350 351 352 353 354 355 |
# File 'lib/procedure_dsl.rb', line 350 def confidence_interval(confidence, &blk) routine = ConfidenceInterval.new(@_log_parser) rv = routine.execute(confidence, &blk) routine.finish rv end |
#count_by(&blk) ⇒ Object
DSL routine ‘count_by’
326 327 328 329 330 331 |
# File 'lib/procedure_dsl.rb', line 326 def count_by(&blk) routine = CountBy.new(@_log_parser) rv = routine.execute(&blk) routine.finish rv end |
#count_where(&blk) ⇒ Object
DSL routine ‘count_where’
286 287 288 289 290 291 |
# File 'lib/procedure_dsl.rb', line 286 def count_where(&blk) routine = CountWhere.new(@_log_parser) rv = routine.execute(&blk) routine.finish rv end |
#distribution(bucket_width, &blk) ⇒ Object
DSL routine ‘distribution’
334 335 336 337 338 339 |
# File 'lib/procedure_dsl.rb', line 334 def distribution(bucket_width, &blk) routine = Distribution.new(@_log_parser) rv = routine.execute(bucket_width, &blk) routine.finish rv end |
#each(&blk) ⇒ Object
DSL routine ‘each’
310 311 312 313 314 315 |
# File 'lib/procedure_dsl.rb', line 310 def each(&blk) routine = Each.new(@_log_parser) routine.execute(&blk) routine.finish nil end |
#eval_procedure(proc_string) ⇒ Object
Evaluates the given string as a procedure in our DSL
281 282 283 |
# File 'lib/procedure_dsl.rb', line 281 def eval_procedure(proc_string) eval proc_string end |
#filter(target_path = nil, &blk) ⇒ Object
DSL routine ‘filter’
302 303 304 305 306 307 |
# File 'lib/procedure_dsl.rb', line 302 def filter(target_path=nil, &blk) routine = Filter.new(@_log_parser) routine.execute(target_path, &blk) routine.finish nil end |
#filter!(&blk) ⇒ Object
DSL routine ‘filter!’
294 295 296 297 298 299 |
# File 'lib/procedure_dsl.rb', line 294 def filter!(&blk) routine = Filter.new(@_log_parser) routine.execute(nil, true, &blk) routine.finish nil end |
#log_distribution(width_base, &blk) ⇒ Object
DSL routine ‘log_distribution’
342 343 344 345 346 347 |
# File 'lib/procedure_dsl.rb', line 342 def log_distribution(width_base, &blk) routine = LogDistribution.new(@_log_parser) rv = routine.execute(width_base, &blk) routine.finish rv end |
#most_common(n, &blk) ⇒ Object
DSL routine ‘most_common’
366 367 368 369 370 371 |
# File 'lib/procedure_dsl.rb', line 366 def most_common(n, &blk) routine = MostCommon.new(@_log_parser) rv = routine.execute(n, &blk) routine.finish rv end |
#percentile(n, &blk) ⇒ Object
DSL routine ‘percentile’
358 359 360 361 362 363 |
# File 'lib/procedure_dsl.rb', line 358 def percentile(n, &blk) routine = Percentile.new(@_log_parser) rv = routine.execute(n, &blk) routine.finish rv end |
#sum(&blk) ⇒ Object
DSL routine ‘sum’
318 319 320 321 322 323 |
# File 'lib/procedure_dsl.rb', line 318 def sum(&blk) routine = Sum.new(@_log_parser) rv = routine.execute(&blk) routine.finish rv end |