Create a new connection to the FAM daemon.
Raises an ArgumentError exception if the number of arguments is not 0 or 1, or a Fam::Error exception if a connection to FAM could not be established.
Examples:
# connect and tell FAM the application is named 'foo' fam = Fam::Connection.new 'foo' # just connect fam = Fam::Connection.new
Create a new connection to the FAM daemon.
Examples:
# connect and tell FAM the application is named 'foo' fam = Fam::Connection.new 'foo' # just connect fam = Fam::Connection.new
Create a new connection to the FAM daemon.
Aliases:
Fam::Connection.open2
Examples:
# connect and tell FAM the application is named 'foo' fam = Fam::Connection.open 'foo' # just connect fam = Fam::Connection.open # connect and close automatically Fam::Connection.open('foo') {|fam| ... }
Create a new connection to the FAM daemon.
Aliases:
Fam::Connection.open2
Examples:
# connect and tell FAM the application is named 'foo' fam = Fam::Connection.open 'foo' # just connect fam = Fam::Connection.open # connect and close automatically Fam::Connection.open('foo') {|fam| ... }
Cancel a monitor request.
Raises a Fam::Error exception if the monitor request could not be cancelled.
Note: this method invalidates the specified monitor request.
Aliases:
Fam::Connection#cancel
Examples:
fam.cancel_monitor req fam.cancel req
this causes a segfault, since ruby attempts to close the connection when it goes out of scope. We‘ll let ruby take care of it. :)
Set the debug level of a Fam::Connection object.
Raises a Fam::Error exception on failure. Note that this method does not exist under Gamin.
Aliases:
Fam::Connection#debug
Examples:
fam.debug = Fam::Debug::VERBOSE
Get the file descriptor of a Fam::Connection object.
Note: This method allows you to wait for FAM events using select() instead of polling via Fam::Connection#pending and Fam::Connection#next_event; see the second example below for more information.
Aliases:
Fam::Connection#get_descriptor Fam::Connection#descriptor Fam::Connection#get_fd
Examples:
# simple use fd = fam.fd # wrap the FAM connection descriptor in an IO object for use in a # select() call io = IO.new fam.fd, 'r' select [io], , , 10
Monitor a collection.
Raises a Fam::Error exception if the collection could not be monitored. Note that this method exists under Gamin, but does not actually do anything.
Aliases:
Fam::Collection#monitor_col Fam::Collection#col
Examples:
req = fam.monitor_col 'download/images', 1, '*.jpg'
Monitor a directory.
Returns a Fam::Request object, which is used to identify the monitor associated with events.
Raises a Fam::Error exception if the directory could not be monitored.
Aliases:
Fam::Connection#monitor_dir Fam::Connection#directory Fam::Connection#dir
Examples:
req = fam.monitor_directory '/tmp'
Monitor a file.
Returns a Fam::Request object, which is used to identify the monitor associated with events.
Raises a Fam::Error exception if the file could not be monitored.
Aliases:
Fam::Connection#file
Examples:
req = fam.monitor_file '/var/log/messages'
Get the next event from the event queue, or block until an event is available.
Raises a Fam::Error exception if FAM couldn’t check for pending events, or if FAM-Ruby couldn’t get the next FAM event.
Aliases:
Fam::Connection#next_ev Fam::Connection#ev
Examples:
ev = fam.next_event
Gamin-specific extension for FAM to not propagate Exists events on directory monitoring startup. This speeds up watching large directories but can introduce a mismatch between the FAM view of the directory and the program own view.
Has no effect if FAMNoExists is not available.
Raises a Fam::Error exception if an error is encountered.
Examples:
fam.no_exists
Are there any events in the queue?
Raises a Fam::Error exception if FAM couldn’t check for pending events.
Aliases:
Fam::Connection#pending
Examples:
puts 'no events pending' unless fam.pending?
Resume (start monitoring) a monitor request.
Raises a Fam::Error exception if the monitor request could not be resumed. Note that this method exists under Gamin, but does not actually do anything.
Aliases:
Fam::Connection#resume
Examples:
fam.resume_monitor req fam.resume req
Suspend (stop monitoring) a monitor request.
Raises a Fam::Error exception if the monitor request could not be suspended. Note that this method exists under Gamin, but does not actually do anything.
Aliases:
Fam::Connection#suspend
Examples:
fam.suspend_monitor req fam.suspend req