Class: DRbQS::Server::CheckAlive
- Inherits:
-
Object
- Object
- DRbQS::Server::CheckAlive
- Defined in:
- lib/drbqs/server/check_alive.rb
Constant Summary collapse
- DEFAULT_INTERVAL_TIME =
300
Instance Method Summary collapse
-
#initialize(interval) ⇒ CheckAlive
constructor
A new instance of CheckAlive.
- #set_checking ⇒ Object
- #significant_interval? ⇒ Boolean
Constructor Details
#initialize(interval) ⇒ CheckAlive
Returns a new instance of CheckAlive.
6 7 8 9 10 11 12 |
# File 'lib/drbqs/server/check_alive.rb', line 6 def initialize(interval) @interval = interval || DEFAULT_INTERVAL_TIME if !(Numeric === @interval) || @interval < 0 raise ArgumentError, "Invalid interval time." end @last = Time.now end |
Instance Method Details
#set_checking ⇒ Object
18 19 20 |
# File 'lib/drbqs/server/check_alive.rb', line 18 def set_checking @last = Time.now end |
#significant_interval? ⇒ Boolean
14 15 16 |
# File 'lib/drbqs/server/check_alive.rb', line 14 def significant_interval? (Time.now - @last) >= @interval end |