Class: Spanx::CLI::Flush
- Inherits:
-
Spanx::CLI
- Object
- Spanx::CLI
- Spanx::CLI::Flush
- Defined in:
- lib/spanx/cli/flush.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
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/spanx/cli/flush.rb', line 45 def run(argv = ARGV) generate_config(argv) out = '' keys = if config[:ip] =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ out << "unblocking ip #{config[:ip]}: " Spanx::IPChecker.new(config[:ip]).unblock elsif config[:all] out << 'unblocking all IPs: ' if config[:debug] Spanx::IPChecker.unblock_all else error_exit_with_msg 'Either -i or -a flag is required now' end out << "deleted #{keys} IPs that matched" puts out if config[:debug] out end |