Class Rucola::FSEvents
In: lib/rucola/fsevents.rb
Parent: Object

Methods

create_stream   new   start   start_watching   stop  

Classes and Modules

Class Rucola::FSEvents::FSEvent
Class Rucola::FSEvents::StreamError

Attributes

allocator  [RW] 
context  [RW] 
flags  [RW] 
latency  [RW] 
paths  [R] 
since  [RW] 
stream  [R] 

Public Class methods

Creates a new FSEvents `watchdog` object. Pass it an array of paths and a block with your callback. Options allow you to specify in more detail how the events watcher should behave.

*:since: The service will report events that have happened after the supplied event ID. Never use 0 because that

  will cause every fsevent since the "beginning of time" to be reported. Use OSX::KFSEventStreamEventIdSinceNow
  if you want to receive events that have happened after this call. (Default: OSX::KFSEventStreamEventIdSinceNow).

*:latency: Number of seconds to wait until an FSEvent is reported, this allows the service to bundle events. (Default: 0.0)

For the rest of the options read the Cocoa documentation.

Initializes a new FSEvents `watchdog` object, creates, starts and then returns the stream.

Pass it a block which will be used as a callback. The block will receive an array of FSEvent objects.

  fsevents = Rucola::FSEvents.start_watching('/some/path') do |events|
    events.each do |event|
      p event
    end
  end
  p fsevents

Public Instance methods

Create the stream. Raises a Rucola::FSEvents::StreamError if the stream could not be created.

Start the stream. Raises a Rucola::FSEvents::StreamError if the stream could not be started.

Stop the stream. You can resume it by calling `start` again.

[Validate]