Google

"DTD/xhtml1-strict.dtd">
Class Fam::Connection
In: fam.c
Methods
Public Class methods
new(int argc, VALUE *argv, VALUE klass)

Create a new connection to the FAM daemon.

Aliases:

  Fam::Connection.open
  Fam::Connection.open2

Examples:

  # connect and tell FAM the application is named 'foo'
  fam = Fam::Connection.new 'foo'

  # just connect
  fam = Fam::Connection.new
open(int argc, VALUE *argv, VALUE klass)

Create a new connection to the FAM daemon.

Aliases:

  Fam::Connection.open
  Fam::Connection.open2

Examples:

  # connect and tell FAM the application is named 'foo'
  fam = Fam::Connection.new 'foo'

  # just connect
  fam = Fam::Connection.new
open2(int argc, VALUE *argv, VALUE klass)

Create a new connection to the FAM daemon.

Aliases:

  Fam::Connection.open
  Fam::Connection.open2

Examples:

  # connect and tell FAM the application is named 'foo'
  fam = Fam::Connection.new 'foo'

  # just connect
  fam = Fam::Connection.new
Public Instance methods
initialize(VALUE self)

Constructor for Fam::Connection object.

This method is currently empty. You should never call this method directly unless you're instantiating a derived class (ie, you know what you're doing).

monitor_directory(VALUE self, VALUE dir)

Monitor a directory.

Returns a Fam::Request object, which is used to identify the monitor associated with events.

Aliases:

  Fam::Connection#monitor_dir
  Fam::Connection#directory
  Fam::Connection#dir

Examples:

  req = fam.monitor_directory '/tmp'
monitor_file(VALUE self, VALUE file)

Monitor a file.

Returns a Fam::Request object, which is used to identify the monitor associated with events.

Aliases:

  Fam::Connection#file

Examples:

  req = fam.monitor_file '/var/log/messages'
monitor_collection(VALUE self, VALUE col, VALUE depth, VALUE mask)

Monitor a collection.

Aliases:

  Fam::Collection#monitor_col
  Fam::Collection#col

Examples:

  req = fam.monitor_col 'download/images', 1, '*.jpg'
suspend_monitor(VALUE self, VALUE request)

Suspend (stop monitoring) a monitor request.

Aliases:

  Fam::Connection#suspend

Examples:

  fam.suspend_monitor req
  fam.suspend req
resume_monitor(VALUE self, VALUE request)

Resume (start monitoring) a monitor request.

Aliases:

  Fam::Connection#resume

Examples:

  fam.resume_monitor req
  fam.resume req
cancel_monitor(VALUE self, VALUE request)

Cancel a monitor request.

Note: this method invalidates the specified monitor request.

Aliases:

  Fam::Connection#cancel

Examples:

  fam.cancel_monitor req
  fam.cancel req
next_event(VALUE self)

Get the next event from the event queue, or block until an event is available.

Aliases:

  Fam::Connection#next_ev
  Fam::Connection#ev

Examples:

  ev = fam.next_event
pending?(VALUE self)

Are there any events in the queue?

Aliases:

  Fam::Connection#pending

Examples:

  puts 'no events pending' unless fam.pending?
debug_level=(VALUE self, VALUE level)

Set the debug level of a Fam::Connection object.

Note: This method is implemented in the bindings, but not in FAM itself.

Aliases:

  Fam::Connection#debug

Examples:

  fam.debug = Fam::Debug::VERBOSE
fd(VALUE self)

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