Module: Nanoc::PluginRegistry::PluginMethods
- Included in:
- DataSource, Extra::Deployer, Extra::VCS, Filter
- Defined in:
- lib/nanoc/base/plugin_registry.rb
Overview
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.
Instance Method Summary (collapse)
-
- (void) identifier(identifier)
Sets the identifier for this plugin.
-
- (void) identifiers(*identifiers)
Sets the identifiers for this plugin.
-
- (Class) named(name)
Returns the plugin with the given name (identifier).
-
- (void) register(class_or_name, *identifiers)
Registers the given class as a plugin with the given identifier.
Instance Method Details
- (void) identifier(identifier)
This method returns an undefined value.
Sets the identifier for this plugin.
30 31 32 |
# File 'lib/nanoc/base/plugin_registry.rb', line 30 def identifier(identifier) register(self, identifier) end |
- (void) identifiers(*identifiers)
This method returns an undefined value.
Sets the identifiers for this plugin.
21 22 23 |
# File 'lib/nanoc/base/plugin_registry.rb', line 21 def identifiers(*identifiers) register(self, *identifiers) end |
- (Class) named(name)
Returns the plugin with the given name (identifier)
58 59 60 |
# File 'lib/nanoc/base/plugin_registry.rb', line 58 def named(name) Nanoc::Plugin.find(self, name) end |
- (void) register(class_or_name, *identifiers)
This method returns an undefined value.
Registers the given class as a plugin with the given identifier.
43 44 45 46 47 48 49 50 51 |
# File 'lib/nanoc/base/plugin_registry.rb', line 43 def register(class_or_name, *identifiers) # Find plugin class klass = self klass = klass.superclass while klass.superclass.respond_to?(:register) # Register registry = Nanoc::PluginRegistry.instance registry.register(klass, class_or_name, *identifiers) end |