Method: RequestLogAnalyzer::Tracker::HourlySpread#report
- Defined in:
- lib/request_log_analyzer/tracker/hourly_spread.rb
#report(output) ⇒ Object
Generate an hourly spread report to the given output object. Any options for the report should have been set during initialize. output
The output object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/request_log_analyzer/tracker/hourly_spread.rb', line 75 def report(output) output.title(title) if total_requests == 0 output << "None found.\n" return end days = [1, timespan].max output.table({}, {:align => :right}, {:type => :ratio, :width => :rest, :treshold => 0.15}) do |rows| @hour_frequencies.each_with_index do |requests, index| ratio = requests.to_f / total_requests.to_f requests_per_day = (requests / days).ceil rows << ["#{index.to_s.rjust(3)}:00", "%d hits/day" % requests_per_day, ratio] end end end |