Class: Puppet::Util::Watcher::PeriodicWatcher

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

Overview

Monitor a given watcher for changes on a periodic interval.

Instance Method Summary collapse

Constructor Details

#initialize(watcher, timer) ⇒ PeriodicWatcher

Returns a new instance of PeriodicWatcher.

Parameters:



9
10
11
12
13
14
# File 'lib/puppet/util/watcher/periodic_watcher.rb', line 9

def initialize(watcher, timer)
  @watcher = watcher
  @timer = timer

  @timer.start
end

Instance Method Details

#changed?true, false

Returns If the file has changed since it was last checked.

Returns:

  • (true, false)

    If the file has changed since it was last checked.



17
18
19
20
21
22
# File 'lib/puppet/util/watcher/periodic_watcher.rb', line 17

def changed?
  return true if always_consider_changed?

  @watcher = examine_watched_info(@watcher)
  @watcher.changed?
end