Class Nanoc::PluginRegistry
In: lib/nanoc/base/plugin_registry.rb
Parent: Object

The class responsible for keeping track of all loaded plugins, such as filters ({Nanoc::Filter}), data sources ({Nanoc::DataSource}) and VCSes ({Nanoc::Extra::VCS}).

Methods

all   find   find_all   identifiers_of   instance   name_for_class   named   new   register   resolve  

Classes and Modules

Module Nanoc::PluginRegistry::PluginMethods

Public Class methods

Returns the shared {PluginRegistry} instance, creating it if none exists yet.

@return [Nanoc::PluginRegistry] The shared plugin registry

Creates a new plugin registry. This should usually not be necessary; it is recommended to use the shared instance (obtained from {Nanoc::PluginRegistry.instance}).

Public Instance methods

Returns a list of all plugins. The returned list of plugins is an array with array elements in the following format:

  { :class => ..., :superclass => ..., :identifiers => ... }

@return [Array<Hash>] A list of all plugins in the format described

Finds the plugin that is a subclass of the given class and has the given name.

@param [Class] klass The class of the plugin to return

@param [Symbol] name The name of the plugin to return

@return [Class, nil] The plugin with the given name

Returns all plugins of the given class.

@param [Class] klass The class of the plugin to return

@return [Enumerable<Class>] A collection of class plugins

@param [Class] superclass The superclass of the plugin. For example:

  {Nanoc::Filter}, {Nanoc::Extra::VCS}.

@param [Class] klass The class to get the identifiers for.

@return [Array<Symbol>] An array of identifiers for the given class

@deprecated Use {Nanoc::PluginRegistry#find} instead

Registers the given class as a plugin.

@param [Class] superclass The superclass of the plugin. For example:

  {Nanoc::Filter}, {Nanoc::Extra::VCS}.

@param [Class, String] class_or_name The class to register. This can be

  a string, in which case it will be automatically converted to a proper
  class at lookup. For example: `Nanoc::Filters::ERB`,
  `"Nanoc::Filters::Haml"`.

@param [Symbol] identifiers One or more symbols identifying the class.

  For example: `:haml`, :`erb`.

@return [void]

Protected Instance methods

[Validate]