lib/nanoc3/base/plugin_registry.rb in nanoc3-3.1.0a1 vs lib/nanoc3/base/plugin_registry.rb in nanoc3-3.1.0a2

- old
+ new

@@ -9,10 +9,11 @@ # 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. module PluginMethods + # Sets the identifiers for this plugin. # # @param [Array<Symbol>] identifier A list of identifiers to assign to # this plugin. # @@ -38,10 +39,16 @@ # @param [Array<Symbol>] identifiers A list of identifiers to assign to # this plugin. # # @return [void] def register(class_or_name, *identifiers) - Nanoc3::Plugin.register(self, 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 # Returns the plugin with the given name (identifier) # # @param [String] name The name of the plugin class to find