Class: Log::Analyzer::CLI::Report

Inherits:
Object
  • Object
show all
Includes:
CommandLineReporter
Defined in:
lib/log-analyzer/cli.rb

Instance Method Summary collapse

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
# 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')
    end
    @endpoints.each do |endpoint|
      row color: 'red' do
        column(endpoint.method)
        column(endpoint.uri_pattern)
        column(endpoint.count)
      end
    end
  end
end