Class: Utils::ProbeServer

Inherits:
Object show all
Defined in:
lib/utils/probe_server.rb

Instance Method Summary collapse

Constructor Details

#initializeProbeServer

Returns a new instance of ProbeServer.



11
12
13
14
# File 'lib/utils/probe_server.rb', line 11

def initialize
  @jobs    = Queue.new
  Thread.new { work_loop }
end

Instance Method Details

#enqueue(job) ⇒ Object Also known as: run



16
17
18
19
# File 'lib/utils/probe_server.rb', line 16

def enqueue(job)
  output_message "Job #{job.inspect} enqueued.".black.on_yellow
  @jobs.push job
end

#shutdownObject



22
23
24
25
# File 'lib/utils/probe_server.rb', line 22

def shutdown
  output_message "Server was shutdown down – HARD!".white.on_red.blink
  exit! 23
end