Class: Puppet::Util::Watcher::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/util/watcher/timer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timeout) ⇒ Timer


4
5
6
# File 'lib/puppet/util/watcher/timer.rb', line 4

def initialize(timeout)
  @timeout = timeout
end

Instance Attribute Details

#timeoutObject (readonly)

Returns the value of attribute timeout


2
3
4
# File 'lib/puppet/util/watcher/timer.rb', line 2

def timeout
  @timeout
end

Instance Method Details

#expired?Boolean


12
13
14
# File 'lib/puppet/util/watcher/timer.rb', line 12

def expired?
  (now - @start_time) >= @timeout
end

#nowObject


16
17
18
# File 'lib/puppet/util/watcher/timer.rb', line 16

def now
  Time.now.to_i
end

#startObject


8
9
10
# File 'lib/puppet/util/watcher/timer.rb', line 8

def start
  @start_time = now
end