Class: RequestLogAnalyzer::Aggregator::Echo
- Defined in:
- lib/request_log_analyzer/aggregator/echo.rb
Overview
Echo Aggregator. Writes everything to the screen when it is passed to this aggregator
Instance Attribute Summary collapse
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Attributes inherited from Base
Instance Method Summary collapse
-
#aggregate(request) ⇒ Object
Display every parsed line immediately to the terminal.
- #prepare ⇒ Object
-
#report(output) ⇒ Object
Display every warning in the report when finished parsing.
-
#warning(type, message, lineno) ⇒ Object
Capture all warnings during parsing.
Methods inherited from Base
#finalize, #initialize, #source_change
Constructor Details
This class inherits a constructor from RequestLogAnalyzer::Aggregator::Base
Instance Attribute Details
#warnings ⇒ Object
Returns the value of attribute warnings.
6 7 8 |
# File 'lib/request_log_analyzer/aggregator/echo.rb', line 6 def warnings @warnings end |
Instance Method Details
#aggregate(request) ⇒ Object
Display every parsed line immediately to the terminal
13 14 15 |
# File 'lib/request_log_analyzer/aggregator/echo.rb', line 13 def aggregate(request) puts "\nRequest: " + request.lines.inspect end |
#prepare ⇒ Object
8 9 10 |
# File 'lib/request_log_analyzer/aggregator/echo.rb', line 8 def prepare @warnings = [] end |
#report(output) ⇒ Object
Display every warning in the report when finished parsing
23 24 25 26 |
# File 'lib/request_log_analyzer/aggregator/echo.rb', line 23 def report(output) output.title("Warnings during parsing") @warnings.each { |w| output.puts(w) } end |
#warning(type, message, lineno) ⇒ Object
Capture all warnings during parsing
18 19 20 |
# File 'lib/request_log_analyzer/aggregator/echo.rb', line 18 def warning(type, , lineno) @warnings << "WARNING #{type.inspect} on line #{lineno}: #{message}" end |