class Dnsblim::CLI::Tables::StatsTable

Public Class Methods

new() click to toggle source
# File lib/dnsblim/cli/tables.rb, line 132
def initialize
  @hl = HighLine.new(STDIN, STDOUT, 80, 1, 2, 1)
  # self.formatter = 'nested'
end

Public Instance Methods

run(obj, _options) click to toggle source
# File lib/dnsblim/cli/tables.rb, line 137
def run(obj, _options)
  table(border: true, width: 65) do
    row(header: true) do
      column('Metric', width: 25, align: 'right')
      column('Value')
    end
    obj.each do |key, value|
      case key
      when 'list'
        value.each do |keyd, val|
          row do
            case keyd
            when 'count'
              column('Total')
            when '1'
              column('Tor | 1')
            when '2'
              column('HTTP(S) Proxies | 2')
            when '3'
              column('SOCKS(4,5) | 3')
            when '4'
              column('Open Router | 4')
            when '5'
              column('Abusive Hosts | 5')
            when '6'
              column('Current Events | 6')
            when '7'
              column('MTA/Mail Servers | 7')
            when 'test'
              column('Test Classes | 250-255')
            end
            column(val.to_s)
          end
        end
      when 'prune'
        row do
          column 'Expiring', align: 'right'
          column value.to_s
        end
      when 'fail2ban', 'irc2ban'
        row do
          column key.to_s.upcase.to_s
          column value.to_s
        end
      end
    end
  end
end