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.
4 5 6 |
# File 'lib/request_log_analyzer/aggregator/echo.rb', line 4 def warnings @warnings end |
Instance Method Details
#aggregate(request) ⇒ Object
Display every parsed line immediately to the terminal
11 12 13 14 15 |
# File 'lib/request_log_analyzer/aggregator/echo.rb', line 11 def aggregate(request) puts "\nRequest: \n" + request.lines.map do |l| "\t#{l[:lineno]}:#{l[:line_type]}: #{l.reject { |(k, _)| [:lineno, :line_type].include?(k) }.inspect}" end.join("\n") end |
#prepare ⇒ Object
6 7 8 |
# File 'lib/request_log_analyzer/aggregator/echo.rb', line 6 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}: #{}" end |