Methods

Listen

Listener implementation for BSD's `kqueue`. @see www.freebsd.org/cgi/man.cgi?query=kqueue @see github.com/mat813/rb-kqueue/blob/master/lib/rb-kqueue/queue.rb

Constants

VERSION

Attributes

stopping[RW]

Public Class Methods

on(target, *args, &block) click to toggle source

Listens to file system modifications broadcast over TCP.

@param [String/Fixnum] target to listen on (hostname:port or port)

@yield [modified, added, removed] the changed files @yieldparam [Array<String>] modified the list of modified files @yieldparam [Array<String>] added the list of added files @yieldparam [Array<String>] removed the list of removed files

@return [Listen::Listener] the listener

# File lib/listen.rb, line 55
def on(target, *args, &block)
  require 'listen/tcp'
  TCP::Listener.new(target, :recipient, *args, &block)
end
stop() click to toggle source

Stop all listeners & Celluloid

Use it for testing purpose or when you are sure that Celluloid could be ended.

# File lib/listen.rb, line 40
def stop
  Celluloid.shutdown
end
to(*args, &block) click to toggle source

Listens to file system modifications on a either single directory or multiple directories.

When :forward_to is specified, this listener will broadcast modifications over TCP.

@param (see Listen::Listener#new)

@yield [modified, added, removed] the changed files @yieldparam [Array<String>] modified the list of modified files @yieldparam [Array<String>] added the list of added files @yieldparam [Array<String>] removed the list of removed files

@return [Listen::Listener] the listener

# File lib/listen.rb, line 23
def to(*args, &block)
  boot_celluloid
  @stopping = false
  options = args.last.is_a?(Hash) ? args.last : {}
  if target = options.delete(:forward_to)
    require 'listen/tcp'
    TCP::Listener.new(target, :broadcaster, *args, &block)
  else
    Listener.new(*args, &block)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.