Class: KQueue::Watcher::File
- Inherits:
-
KQueue::Watcher
- Object
- KQueue::Watcher
- KQueue::Watcher::File
- Defined in:
- lib/rb-kqueue/watcher/file.rb
Overview
The KQueue::Watcher subclass for events fired when a file changes. File events are watched via Queue#watch_file.
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The path to the file being watched.
Attributes inherited from KQueue::Watcher
Class Method Summary collapse
Methods inherited from KQueue::Watcher
#add!, #delete!, #disable!, #enable!
Instance Attribute Details
#path ⇒ String (readonly)
The path to the file being watched.
9 10 11 |
# File 'lib/rb-kqueue/watcher/file.rb', line 9 def path @path end |
Class Method Details
.finalizer(fd, path) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rb-kqueue/watcher/file.rb', line 44 def self.finalizer(fd, path) lambda do |id=nil| next unless Native.close(fd) < 0 raise SystemCallError.new( "Failed to close file #{path}" + case FFI.errno when Errno::EBADF::Errno; ": Invalid file descriptor." when Errno::EINTR::Errno; ": Closing interrupted." when Errno::EIO::Errno; ": IO error." else; "" end, FFI.errno) end end |