Class: FunWith::Files::Watchers::MissingWatcher

Inherits:
NodeWatcher
  • Object
show all
Defined in:
lib/fun_with/files/watchers/missing_watcher.rb

Overview

Watches a path where nothing currently exists, and reports a change if something appears there.

Instance Attribute Summary

Attributes inherited from NodeWatcher

#path

Instance Method Summary collapse

Methods inherited from NodeWatcher

#create_watchers, #new_changeset, #set_path

Constructor Details

#initialize(path) ⇒ MissingWatcher

Returns a new instance of MissingWatcher.



7
8
9
# File 'lib/fun_with/files/watchers/missing_watcher.rb', line 7

def initialize( path )
  set_path( path )
end

Instance Method Details

#all_pathsObject



17
18
19
# File 'lib/fun_with/files/watchers/missing_watcher.rb', line 17

def all_paths
  []
end

#updateObject

The fact that the watcher now needs to be replaced with a File/DirectoryWatcher must be handled elsewhere.



13
14
15
# File 'lib/fun_with/files/watchers/missing_watcher.rb', line 13

def update
  self.path.exist? ? {self.path => :created } : {}
end