class FChange::Watcher
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 ? 1 : 0 @id = Native.FindFirstChangeNotificationA(path, @recursive, Native::Flags.to_mask(flags)); @id = Native.FindFirstChangeNotificationW(normalize_path(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