Class: LogBench::App::Monitor
- Inherits:
-
Object
- Object
- LogBench::App::Monitor
- Defined in:
- lib/log_bench/app/monitor.rb
Instance Method Summary collapse
-
#initialize(log_file_path, state) ⇒ Monitor
constructor
A new instance of Monitor.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(log_file_path, state) ⇒ Monitor
6 7 8 9 10 |
# File 'lib/log_bench/app/monitor.rb', line 6 def initialize(log_file_path, state) self.log_file_path = log_file_path self.state = state self.running = false end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 |
# File 'lib/log_bench/app/monitor.rb', line 12 def start return if running self.running = true self.thread = Thread.new { monitor_loop } end |
#stop ⇒ Object
19 20 21 22 |
# File 'lib/log_bench/app/monitor.rb', line 19 def stop self.running = false thread&.kill end |