Class: LogBench::App::Monitor

Inherits:
Object
  • Object
show all
Defined in:
lib/log_bench/app/monitor.rb

Instance Method Summary collapse

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

#startObject



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

#stopObject



19
20
21
22
# File 'lib/log_bench/app/monitor.rb', line 19

def stop
  self.running = false
  thread&.kill
end