class Inotify::Watcher

Defined in:

inotify/watcher.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(recursive : Bool = false) #

Creates a new inotify instance and starts reading from the event queue. Optional: Set recursive to true to automatically watch all new subdirectories.


[View source]

Instance Method Detail

def clear_event_handlers #

Removes all event handlers added with #on_event.


[View source]
def close #

Closes file descriptor referring to the inotify instance.


[View source]
def finalize #

[View source]
def on_event(&block : Event -> ) #

Attach a &block to the instance, this will receive all events.


[View source]
def unwatch(path : String) #

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.


[View source]
def unwatch(wd : LibC::Int) #

Removes an item from an inotify watch list based on its watch descriptor wd. Returns true on success, otherwise raises.


[View source]
def watch(path : String, mask = DEFAULT_WATCH_FLAG) #

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.


[View source]
def watching : Array(String) #

Returns all paths that are currently being watched.


[View source]