Class: Minus5::Daemon::Base
- Inherits:
-
Object
- Object
- Minus5::Daemon::Base
- Defined in:
- lib/minus5_daemon/base.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(options, logger) ⇒ Base
constructor
A new instance of Base.
- #run ⇒ Object
Constructor Details
#initialize(options, logger) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 11 |
# File 'lib/minus5_daemon/base.rb', line 6 def initialize(, logger) @options = @logger = logger @active = true @sleep_interval = 1 end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
13 14 15 |
# File 'lib/minus5_daemon/base.rb', line 13 def logger @logger end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/minus5_daemon/base.rb', line 15 def run on_start Signal.trap("TERM") do logger.debug "TERM signal received" @active = false on_stop end while @active run_loop sleep_with_check end end |