Class: Assistor::Daemon
- Inherits:
-
Object
- Object
- Assistor::Daemon
- Extended by:
- Forwardable
- Defined in:
- lib/assistor/daemon.rb
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Daemon
constructor
A new instance of Daemon.
- #name ⇒ Object
- #run(queue) ⇒ Object
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
#name ⇒ Object
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 |