Module: Nanoc::Int::PluginRegistry::PluginMethods Private
- Included in:
- DataSource, Extra::Checking::Check, Extra::Deployer, Filter, ActionProvider
- Defined in:
- lib/nanoc/base/plugin_registry.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
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
-
#all ⇒ Hash<Symbol, Class>
private
All plugins of this type, with keys being the identifiers and values the plugin classes.
- #identifier(identifier = nil) ⇒ Object private
- #identifiers(*identifiers) ⇒ Object private
-
#named(name) ⇒ Class
private
Returns the plugin with the given name (identifier).
-
#register(class_or_name, *identifiers) ⇒ void
private
Registers the given class as a plugin with the given identifier.
Instance Method Details
#all ⇒ Hash<Symbol, Class>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns All plugins of this type, with keys being the identifiers and values the plugin classes.
73 74 75 |
# File 'lib/nanoc/base/plugin_registry.rb', line 73 def all Nanoc::Int::PluginRegistry.instance.find_all(self) end |
#identifier(identifier) ⇒ void #identifier ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 47 48 49 50 |
# File 'lib/nanoc/base/plugin_registry.rb', line 44 def identifier(identifier = nil) if identifier identifiers(identifier) else Nanoc::Int::PluginRegistry.instance.identifiers_of(superclass, self).first end end |
#identifiers(*identifiers) ⇒ void #identifiers ⇒ Array<Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 28 29 30 31 |
# File 'lib/nanoc/base/plugin_registry.rb', line 25 def identifiers(*identifiers) if identifiers.empty? Nanoc::Int::PluginRegistry.instance.identifiers_of(superclass, self) else register(self, *identifiers) end end |
#named(name) ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the plugin with the given name (identifier)
82 83 84 |
# File 'lib/nanoc/base/plugin_registry.rb', line 82 def named(name) Nanoc::Int::PluginRegistry.instance.find(self, name) end |
#register(class_or_name, *identifiers) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Registers the given class as a plugin with the given identifier.
61 62 63 64 65 66 67 68 69 |
# File 'lib/nanoc/base/plugin_registry.rb', line 61 def register(class_or_name, *identifiers) # Find plugin class klass = self klass = klass.superclass while klass.superclass.respond_to?(:register) # Register registry = Nanoc::Int::PluginRegistry.instance registry.register(klass, class_or_name, *identifiers) end |