class Isomorfeus::Puppetmaster::Server::Timer

Public Class Methods

new(expire_in:) click to toggle source
# File lib/isomorfeus/puppetmaster/server.rb, line 5
def initialize(expire_in:)
  @start = current
  @expire_in = expire_in
end

Public Instance Methods

expired?() click to toggle source
# 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?() click to toggle source
# File lib/isomorfeus/puppetmaster/server.rb, line 16
def stalled?
  @start == current
end

Private Instance Methods

current() click to toggle source
# File lib/isomorfeus/puppetmaster/server.rb, line 23
def current; Process.clock_gettime Process::CLOCK_MONOTONIC; end