Class: RequestLogAnalyzer::Aggregator::Echo

Inherits:
Base
  • Object
show all
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

Attributes inherited from Base

#options, #source

Instance Method Summary collapse

Methods inherited from Base

#finalize, #initialize, #source_change

Constructor Details

This class inherits a constructor from RequestLogAnalyzer::Aggregator::Base

Instance Attribute Details

#warningsObject

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

#prepareObject



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, message, lineno)
  @warnings << "WARNING #{type.inspect} on line #{lineno}: #{message}"
end