Class: Netgrep::Runner
- Inherits:
-
Object
- Object
- Netgrep::Runner
- Defined in:
- lib/netgrep/runner.rb
Instance Attribute Summary collapse
-
#matches ⇒ Object
Returns the value of attribute matches.
Instance Method Summary collapse
-
#initialize(log_file:, netblocks_file:, num_workers: 1, ignore_ipv6: false) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(log_file:, netblocks_file:, num_workers: 1, ignore_ipv6: false) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 14 15 16 |
# File 'lib/netgrep/runner.rb', line 8 def initialize(log_file:, netblocks_file:, num_workers: 1, ignore_ipv6: false) @log_file = log_file @netblocks_file = netblocks_file @num_workers = num_workers @ignore_ipv6 = ignore_ipv6?(ignore_ipv6) @matches = [] @worker_pids = [] @pipe_reader, @pipe_writer = IO.pipe end |
Instance Attribute Details
#matches ⇒ Object
Returns the value of attribute matches.
6 7 8 |
# File 'lib/netgrep/runner.rb', line 6 def matches @matches end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/netgrep/runner.rb', line 18 def run start_workers collect_matches shutdown_workers print_matches self end |