A module that contains class methods for plugins. It provides functions for setting identifiers, registering plugins and finding plugins. Plugin classes should extend this module.
Sets the identifier for this plugin.
@param [Symbol] identifier An identifier to assign to this plugin.
@return [void]
# File lib/nanoc3/base/plugin_registry.rb, line 29 def identifier(identifier) register(self, identifier) end
Sets the identifiers for this plugin.
@param [Array<Symbol>] identifier A list of identifiers to assign to this plugin.
@return [void]
# File lib/nanoc3/base/plugin_registry.rb, line 20 def identifiers(*identifiers) register(self, *identifiers) end
Returns the plugin with the given name (identifier)
@param [String] name The name of the plugin class to find
@return [Class] The plugin class with the given name
# File lib/nanoc3/base/plugin_registry.rb, line 57 def named(name) Nanoc3::Plugin.find(self, name) end
Registers the given class as a plugin with the given identifier.
@param [Class, String] class_or_name The class to register, or a string containing the class name to register.
@param [Array<Symbol>] identifiers A list of identifiers to assign to this plugin.
@return [void]
# File lib/nanoc3/base/plugin_registry.rb, line 42 def register(class_or_name, *identifiers) # Find plugin class klass = self klass = klass.superclass while klass.superclass.respond_to?(:register) # Register registry = Nanoc3::PluginRegistry.instance registry.register(klass, class_or_name, *identifiers) end
Generated with the Darkfish Rdoc Generator 2.