Class: Spanx::CLI::Report
- Inherits:
-
Spanx::CLI
- Object
- Spanx::CLI
- Spanx::CLI::Report
- Defined in:
- lib/spanx/cli/report.rb
Instance Attribute Summary
Attributes inherited from Spanx::CLI
Instance Method Summary collapse
Methods included from Helper::Subclassing
Methods included from Helper::Exit
#error_exit_with_msg, #help_exit
Instance Method Details
#run(argv = ARGV) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/spanx/cli/report.rb', line 51 def run(argv = ARGV) generate_config(argv) out = '' if config[:blocked] ips = Spanx::IPChecker.rate_limited_identifiers out << report_ips('Blocked', ips) end if config[:tracked] ips = Spanx::IPChecker.tracked_identifiers out << report_ips('Tracked', ips) end if config[:summary] or (config[:blocked].nil? && config[:tracked].nil?) out << " Total tracked IPS: #{Spanx::IPChecker.tracked_identifiers.size}\n" out << " Total blocked IPS: #{Spanx::IPChecker.rate_limited_identifiers.size}\n" out << "___________________\n\n" out << "Keeping history for: #{config[:collector][:history] / 3600 }hrs\n" out << " Time resolution: #{config[:collector][:resolution] / 60 }min\n" end puts out out end |