Class

Plugin

Extends:

Includes:

The Plugin class should be an object which provides the following methods:

  • name - used during initialisation to order the plugin (based on name and
    the contents of <tt>config.plugins</tt>)
  • +valid?+ - returns true if this plugin can be loaded
  • load_paths - each path within the returned array will be added to the $LOAD_PATH
  • load - finally ‘load’ the plugin.

These methods are expected by the Rails::Plugin::Locator and Rails::Plugin::Loader classes. The default implementation returns the lib directory as its load_paths, and evaluates init.rb when load is called.

Classes
FileSystemLocator The Rails::Plugin::FileSystemLocator will try to locate plugins by examining the directories the the paths given in configuration.plugin_paths. Any plugins that can be found are returned in a list.
Loader
Locator The Plugin::Locator class should be subclasses to provide custom plugin-finding abilities to Rails (i.e. loading plugins from Gems, etc). Each subclass should implement the located_plugins method, which return an array of Plugin objects that have been found.
Public Attributes
directory
name
Public Methods
<=>
load Evaluates a plugin’s init.rb file
load_paths Returns a list of paths this plugin wishes to make available in $LOAD_PATH
loaded?
new
valid?
Private Methods
evaluate_init_rb
has_init_file?
has_lib_directory?
init_path
lib_path
report_nonexistant_or_empty_plugin!
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.