class Inotify::Watcher
- Inotify::Watcher
- Reference
- Object
Defined in:
inotify/watcher.crConstructors
-
.new(recursive : Bool = false)
Creates a new inotify instance and starts reading from the event queue.
Instance Method Summary
-
#clear_event_handlers
Removes all event handlers added with
#on_event
. -
#close
Closes file descriptor referring to the inotify instance.
- #finalize
-
#on_event(&block : Event -> )
Attach a
&block
to the instance, this will receive all events. -
#unwatch(path : String)
Removes an item from an inotify watch list based on its path.
-
#unwatch(wd : LibC::Int)
Removes an item from an inotify watch list based on its watch descriptor wd.
-
#watch(path : String, mask = DEFAULT_WATCH_FLAG)
Adds a new watch, or modifies an existing watch, for the path specified.
-
#watching : Array(String)
Returns all paths that are currently being watched.
Constructor Detail
Creates a new inotify instance and starts reading from the event queue.
Optional: Set recursive to true
to automatically watch all new subdirectories.
Instance Method Detail
Attach a &block
to the instance, this will receive all events.
Removes an item from an inotify watch list based on its path. Returns true
on success.
NOTE path is case sensitive and has to be an exact match, to what was passed into #watch
.
Removes an item from an inotify watch list based on its watch descriptor wd.
Returns true
on success, otherwise raises.
Adds a new watch, or modifies an existing watch, for the path specified. Optional: The events to be monitored can be specified in the mask bit-mask argument.