Last Modified
2014-01-23 06:35:08 +0000
Requires

Description

An Eventable Scanner is one that can be utilized by something that has an Event Loop. It is intended to be subclassed by classes that implement the specific event loop semantics for say EventMachine or Cool.io.

The Events that the EventableScanner is programmed for are:

on_scan - this should be called every interval times on_modified - If the event loop can monitor individual files then this should

be called when the file is modified

on_removed - Similar to on_modified but called when a file is removed.

Sub classes are required to implement the following:

start_loop_with_attached_scan_timer() - Instance Method
  This method is to start up the loop, if necessary assign to @loop_thread
  instance variable the Thread that is controlling the event loop.

  This method must also assign an object to @timer which is what does the
  periodic scanning of the globs. This object must respond to +detach()+ so
  that it may be detached from the event loop.

stop_loop() - Instance Method
  This method must shut down the event loop, or detach these classes from
  the event loop if we just attached to an existing event loop.

Watcher - An Embedded class
  This is a class that must have a class method +watcher(path,scanner)+
  which is used to instantiate a file watcher. The Watcher instance must
  respond to +detach()+ so that it may be independently detached from the
  event loop.