Class: Isomorfeus::Puppetmaster::Server::Timer
- Inherits:
-
Object
- Object
- Isomorfeus::Puppetmaster::Server::Timer
- Defined in:
- lib/isomorfeus/puppetmaster/server.rb
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(expire_in:) ⇒ Timer
constructor
A new instance of Timer.
- #stalled? ⇒ Boolean
Constructor Details
#initialize(expire_in:) ⇒ Timer
Returns a new instance of Timer.
5 6 7 8 |
# File 'lib/isomorfeus/puppetmaster/server.rb', line 5 def initialize(expire_in:) @start = current @expire_in = expire_in end |
Instance Method Details
#expired? ⇒ Boolean
10 11 12 13 14 |
# File 'lib/isomorfeus/puppetmaster/server.rb', line 10 def expired? raise Isomorfeus::Puppetmaster::FrozenInTime, 'Time appears to be frozen. Puppetmaster does not work with libraries which freeze time, consider using time travelling instead' if stalled? current - @start >= @expire_in end |
#stalled? ⇒ Boolean
16 17 18 |
# File 'lib/isomorfeus/puppetmaster/server.rb', line 16 def stalled? @start == current end |