class FChange::Watcher
is to be able to disable them using {#close}.
The main purpose of having Watcher objects
via {Notifier#run #run} or {Notifier#process #process}.
The Notifier actually takes care of the checking for events,
One {Notifier} may have many {Watcher}s.
A watcher is usually created via {Notifier#watch}.
specified by {FChange::Notifier#watch event flags}.
Watchers monitor a single path for changes,
def callback!(event)
-
event
(Event
) --
Other tags:
- Private: -
def callback!(event) @callback[event] end
def close
-
(SystemCallError)
- if the watch fails to be disabled for some reason
def close r = Native.k32FindCloseChangeNotification(@id) #@notifier.remove_watcher(self) return if r == 0 raise SystemCallError.new("Failed to stop watching #{@path.inspect}", r) end
def initialize(notifier, path, recursive, *flags, &callback)
- See: Notifier#watch -
Other tags:
- Private: -
def initialize(notifier, path, recursive, *flags, &callback) @notifier = notifier @callback = callback || proc {} @path = path @flags = flags @recursive = recursive @id = Native.k32FindFirstChangeNotification(path, recursive, Native::Flags.to_mask(flags)); unless @id < 0 @notifier.add_watcher(self) return end raise SystemCallError.new("Failed to watch #{path.inspect}", @id) end