class RequestLogAnalyzer::Aggregator::Summarizer::Definer

Attributes

trackers[R]

Public Class Methods

new() click to toggle source

Initialize tracker array

  # File lib/request_log_analyzer/aggregator/summarizer.rb
7 def initialize
8   @trackers = []
9 end

Public Instance Methods

initialize_copy(other) click to toggle source

Initialize tracker summarizer by duping the trackers of another summarizer other The other Summarizer

   # File lib/request_log_analyzer/aggregator/summarizer.rb
13 def initialize_copy(other)
14   @trackers = other.trackers.dup
15 end
method_missing(tracker_method, *args) click to toggle source

Include missing trackers through method missing.

   # File lib/request_log_analyzer/aggregator/summarizer.rb
23 def method_missing(tracker_method, *args)
24   track(tracker_method, *args)
25 end
reset!() click to toggle source

Drop all trackers

   # File lib/request_log_analyzer/aggregator/summarizer.rb
18 def reset!
19   @trackers = []
20 end
track(tracker_klass, value_field = {}, other_options = {}) click to toggle source

Helper function to initialize a tracker and add it to the tracker array. tracker_class The class to include optiont The options to pass to the trackers.

   # File lib/request_log_analyzer/aggregator/summarizer.rb
30 def track(tracker_klass, value_field = {}, other_options = {})
31   options = value_field.is_a?(Symbol) ? other_options.merge(value: value_field) : value_field.merge(other_options)
32   tracker_klass = RequestLogAnalyzer::Tracker.const_get(RequestLogAnalyzer.to_camelcase(tracker_klass)) if tracker_klass.is_a?(Symbol)
33   @trackers << tracker_klass.new(options)
34 end