Class: ProconBypassMan::Watchdog

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/support/watchdog.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


9
10
11
# File 'lib/procon_bypass_man/support/watchdog.rb', line 9

def outdated?
  @time < Time.now
end

#timeTime

Returns:

  • (Time)


14
15
16
# File 'lib/procon_bypass_man/support/watchdog.rb', line 14

def time
  @time
end