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

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timeout) ⇒ Timer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Timer.

API:

  • private



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

def initialize(timeout)
  @timeout = timeout
end

Instance Attribute Details

#timeoutObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



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

def timeout
  @timeout
end

Instance Method Details

#expired?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



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

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

#nowObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



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

def now
  Time.now.to_i
end

#startObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



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

def start
  @start_time = now
end