class RequestLogAnalyzer::Source::Base

The base Source class. All other sources should inherit from this class.

A source implememtation should at least implement the each_request method, which should yield RequestLogAnalyzer::Request instances that will be fed through the pipleine.

Attributes

current_request[R]

The current Request object that is being parsed

file_format[R]

The FileFormat instance that describes the format of this source.

options[R]

A hash of options

parsed_lines[R]

The total number of parsed lines

parsed_requests[R]

The total number of parsed requests.

skipped_lines[R]

The number of skipped lines because of warnings

skipped_requests[R]

The total number of skipped requests because of filters.

Public Class Methods

new(format, options = {}) click to toggle source

Initializer, which will register the file format and save any options given as a hash.

format

The file format instance

options

A hash of options that can be used by a specific Source implementation

   # File lib/request_log_analyzer/source.rb
39 def initialize(format, options = {})
40   @options     = options
41   @file_format = format
42 end

Public Instance Methods

each_request(_options = {}) { |request| ... } click to toggle source

This function is called to actually produce the requests that will be send into the pipeline. The implementation should yield instances of RequestLogAnalyzer::Request.

options

A Hash of options that can be used in the implementation.

   # File lib/request_log_analyzer/source.rb
53 def each_request(_options = {}, &_block) # :yields: request
54   true
55 end
finalize() click to toggle source

This function is called after RequestLogAnalyzer::Source::Base#each_request finished. Any code to wrap up, free resources, etc. can be put in this method.

   # File lib/request_log_analyzer/source.rb
59 def finalize
60 end
prepare() click to toggle source

The prepare method is called before the RequestLogAnalyzer::Source::Base#each_request method is called. Use this method to implement any initialization that should occur before this source can produce Request instances.

   # File lib/request_log_analyzer/source.rb
47 def prepare
48 end