Class: FunWith::Files::Watchers::NodeWatcher

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

Direct Known Subclasses

DirectoryWatcher, FileWatcher, MissingWatcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#create_watchers(paths) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/fun_with/files/watchers/node_watcher.rb', line 23

def create_watchers( paths )
  {}.tap do |watchers|
    for path in paths
      watchers[path.fwf_filepath] = Watcher.factory( path )
    end
  end
end

#new_changeset(&block) ⇒ Object

sets up an object variable for changes, then clears it and returns the changes. I got sick of passing the changes hash around.



33
34
35
36
37
38
39
40
# File 'lib/fun_with/files/watchers/node_watcher.rb', line 33

def new_changeset( &block )
  @changes = {}
  yield

  changes = @changes
  @changes = {}
  changes
end

#set_path(path) ⇒ Object



19
20
21
# File 'lib/fun_with/files/watchers/node_watcher.rb', line 19

def set_path( path )
  self.path = path.fwf_filepath
end