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) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(log_file:, netblocks_file:, num_workers: 1) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 14 15 |
# File 'lib/netgrep/runner.rb', line 8 def initialize(log_file:, netblocks_file:, num_workers: 1) @log_file = log_file @netblocks_file = netblocks_file @num_workers = num_workers @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
17 18 19 20 21 22 23 |
# File 'lib/netgrep/runner.rb', line 17 def run start_workers collect_matches shutdown_workers print_matches self end |