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:



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

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.



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

def changed?
  return true if always_consider_changed?

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