Class: ProconBypassMan::Watchdog
- Inherits:
-
Object
- Object
- ProconBypassMan::Watchdog
- Defined in:
- lib/procon_bypass_man/support/watchdog.rb
Instance Method Summary collapse
- #active! ⇒ void
-
#initialize(timeout: 100) ⇒ Watchdog
constructor
A new instance of Watchdog.
- #outdated? ⇒ Boolean
- #time ⇒ Time
Constructor Details
#initialize(timeout: 100) ⇒ Watchdog
Returns a new instance of Watchdog.
3 4 5 6 |
# File 'lib/procon_bypass_man/support/watchdog.rb', line 3 def initialize(timeout: 100) @timeout = timeout active! end |
Instance Method Details
#active! ⇒ void
This method returns an undefined value.
19 20 21 |
# File 'lib/procon_bypass_man/support/watchdog.rb', line 19 def active! @time = Time.now + @timeout end |
#outdated? ⇒ Boolean
9 10 11 |
# File 'lib/procon_bypass_man/support/watchdog.rb', line 9 def outdated? @time < Time.now end |
#time ⇒ Time
14 15 16 |
# File 'lib/procon_bypass_man/support/watchdog.rb', line 14 def time @time end |