Class: Assistor::Daemon

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/assistor/daemon.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Daemon

Returns a new instance of Daemon.



7
8
9
# File 'lib/assistor/daemon.rb', line 7

def initialize(configuration)
  @configuration = configuration
end

Instance Method Details

#nameObject



11
12
13
# File 'lib/assistor/daemon.rb', line 11

def name
  [:assistor, id].join ':'
end

#run(queue) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/assistor/daemon.rb', line 15

def run(queue)
  start
  loop do
    sleep(delay) unless assist(queue)
  end
rescue => e
  log_file.error e
  @configuration.exception_handler.call(e)
end