class RequestLogAnalyzer::Aggregator::Echo

Echo Aggregator. Writes everything to the screen when it is passed to this aggregator

Attributes

warnings[RW]

Public Instance Methods

aggregate(request) click to toggle source

Display every parsed line immediately to the terminal

   # File lib/request_log_analyzer/aggregator/echo.rb
11 def aggregate(request)
12   puts "\nRequest: \n" + request.lines.map do |l|
13     "\t#{l[:lineno]}:#{l[:line_type]}: #{l.reject { |(k, _)| [:lineno, :line_type].include?(k) }.inspect}"
14   end.join("\n")
15 end
prepare() click to toggle source
  # File lib/request_log_analyzer/aggregator/echo.rb
6 def prepare
7   @warnings = []
8 end
report(output) click to toggle source

Display every warning in the report when finished parsing

   # File lib/request_log_analyzer/aggregator/echo.rb
23 def report(output)
24   output.title('Warnings during parsing')
25   @warnings.each { |w| output.puts(w) }
26 end
warning(type, message, lineno) click to toggle source

Capture all warnings during parsing

   # File lib/request_log_analyzer/aggregator/echo.rb
18 def warning(type, message, lineno)
19   @warnings << "WARNING #{type.inspect} on line #{lineno}: #{message}"
20 end