Module: Inotify

Extended by:
FFI::Library
Includes:
Const
Defined in:
lib/inotify-ffi.rb

Defined Under Namespace

Modules: Connection, Const Classes: Event, EventStruct, Watcher

Constant Summary collapse

IN_MOVE =
(IN_MOVED_FROM | IN_MOVED_TO)
IN_CLOSE =
(IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
IN_ALL_EVENTS =
(IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \
| IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \
| IN_MOVED_TO | IN_CREATE | IN_DELETE \
| IN_DELETE_SELF | IN_MOVE_SELF)

Constants included from Const

Const::IN_ACCESS, Const::IN_ATTRIB, Const::IN_CLOSE_NOWRITE, Const::IN_CLOSE_WRITE, Const::IN_CREATE, Const::IN_DELETE, Const::IN_DELETE_SELF, Const::IN_DONT_FOLLOW, Const::IN_IGNORED, Const::IN_ISDIR, Const::IN_MASK_ADD, Const::IN_MODIFY, Const::IN_MOVED_FROM, Const::IN_MOVED_TO, Const::IN_MOVE_SELF, Const::IN_ONESHOT, Const::IN_ONLYDIR, Const::IN_OPEN, Const::IN_Q_OVERFLOW, Const::IN_UNMOUNT

Class Method Summary collapse

Class Method Details

.process_event(fd) ⇒ Object



50
51
52
53
54
55
# File 'lib/inotify-ffi.rb', line 50

def self.process_event(fd)
  buf = FFI::Buffer.alloc_out(EventStruct.size + 4096, 1, false)
  ev = EventStruct.new(buf)
  n = Inotify.read(fd, buf, buf.total)
  Event.new(ev, buf)
end

.watch(path, event_mask = IN_ALL_EVENTS) ⇒ Object



11
12
13
# File 'lib/inotify-ffi.rb', line 11

def self.watch(path, event_mask = IN_ALL_EVENTS)
  Watcher.setup(path, event_mask)
end