Class: Log::Analyzer::CLI::Report
- Inherits:
-
Object
- Object
- Log::Analyzer::CLI::Report
- Includes:
- CommandLineReporter
- Defined in:
- lib/log-analyzer/cli.rb
Instance Method Summary collapse
-
#initialize(endpoints) ⇒ Report
constructor
A new instance of Report.
- #run ⇒ Object
Constructor Details
#initialize(endpoints) ⇒ Report
Returns a new instance of Report.
14 15 16 |
# File 'lib/log-analyzer/cli.rb', line 14 def initialize(endpoints) @endpoints = endpoints end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/log-analyzer/cli.rb', line 18 def run table(width: :auto, border: true) do row header: true, color: 'red' do column('method') column('endpoint') column('count') @endpoints.first.values.keys.each do |key| column("#{key}(avg)") column("#{key}(max)") column("#{key}(min)") end end @endpoints.each do |endpoint| row color: 'red' do column(endpoint.method) column(endpoint.uri_pattern) column(endpoint.count) endpoint.values.each do |_, val| column(val.total.quo(endpoint.count).to_f.round(2)) column(val.max) column(val.min) end end end end end |