Class: Isomorfeus::Puppetmaster::Server::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/isomorfeus/puppetmaster/server.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)

Raises:

  • (Isomorfeus::Puppetmaster::FrozenInTime)


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

Returns:

  • (Boolean)


16
17
18
# File 'lib/isomorfeus/puppetmaster/server.rb', line 16

def stalled?
  @start == current
end