Class: RequestLogAnalyzer::Source::Base
- Inherits:
-
Object
- Object
- RequestLogAnalyzer::Source::Base
- Defined in:
- lib/request_log_analyzer/source.rb
Overview
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.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#current_request ⇒ Object
readonly
The current Request object that is being parsed.
-
#file_format ⇒ Object
readonly
The FileFormat instance that describes the format of this source.
-
#options ⇒ Object
readonly
A hash of options.
-
#parsed_lines ⇒ Object
readonly
The total number of parsed lines.
-
#parsed_requests ⇒ Object
readonly
The total number of parsed requests.
-
#skipped_lines ⇒ Object
readonly
The number of skipped lines because of warnings.
-
#skipped_requests ⇒ Object
readonly
The total number of skipped requests because of filters.
Instance Method Summary collapse
-
#each_request(options = {}, &block) ⇒ Object
This function is called to actually produce the requests that will be send into the pipeline.
-
#finalize ⇒ Object
This function is called after RequestLogAnalyzer::Source::Base#each_request finished.
-
#initialize(format, options = {}) ⇒ Base
constructor
Initializer, which will register the file format and save any options given as a hash.
-
#prepare ⇒ Object
The prepare method is called before the RequestLogAnalyzer::Source::Base#each_request method is called.
Constructor Details
#initialize(format, options = {}) ⇒ Base
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
48 49 50 51 |
# File 'lib/request_log_analyzer/source.rb', line 48 def initialize(format, = {}) @options = @file_format = format end |
Instance Attribute Details
#current_request ⇒ Object (readonly)
The current Request object that is being parsed
28 29 30 |
# File 'lib/request_log_analyzer/source.rb', line 28 def current_request @current_request end |
#file_format ⇒ Object (readonly)
The FileFormat instance that describes the format of this source.
43 44 45 |
# File 'lib/request_log_analyzer/source.rb', line 43 def file_format @file_format end |
#options ⇒ Object (readonly)
A hash of options
25 26 27 |
# File 'lib/request_log_analyzer/source.rb', line 25 def @options end |
#parsed_lines ⇒ Object (readonly)
The total number of parsed lines
31 32 33 |
# File 'lib/request_log_analyzer/source.rb', line 31 def parsed_lines @parsed_lines end |
#parsed_requests ⇒ Object (readonly)
The total number of parsed requests.
37 38 39 |
# File 'lib/request_log_analyzer/source.rb', line 37 def parsed_requests @parsed_requests end |
#skipped_lines ⇒ Object (readonly)
The number of skipped lines because of warnings
34 35 36 |
# File 'lib/request_log_analyzer/source.rb', line 34 def skipped_lines @skipped_lines end |
#skipped_requests ⇒ Object (readonly)
The total number of skipped requests because of filters.
40 41 42 |
# File 'lib/request_log_analyzer/source.rb', line 40 def skipped_requests @skipped_requests end |
Instance Method Details
#each_request(options = {}, &block) ⇒ Object
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.
62 63 64 |
# File 'lib/request_log_analyzer/source.rb', line 62 def each_request( = {}, &block) # :yields: request return true end |
#finalize ⇒ Object
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.
68 69 |
# File 'lib/request_log_analyzer/source.rb', line 68 def finalize end |
#prepare ⇒ Object
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.
56 57 |
# File 'lib/request_log_analyzer/source.rb', line 56 def prepare end |