module Roda::RodaPlugins::Base::ClassMethods
def plugin(plugin, *args, &block)
Roda.plugin PluginModule
which will be required and then used.
which is used directly, or a symbol represented a registered plugin
Load a new plugin into the current class. A plugin can be a module
def plugin(plugin, *args, &block) if plugin.is_a?(Symbol) plugin = RodaPlugins.load_plugin(plugin) end if plugin.respond_to?(:load_dependencies) plugin.load_dependencies(self, *args, &block) end if defined?(plugin::InstanceMethods) include(plugin::InstanceMethods) end if defined?(plugin::ClassMethods) extend(plugin::ClassMethods) end if defined?(plugin::RequestMethods) self::RodaRequest.send(:include, plugin::RequestMethods) end if defined?(plugin::RequestClassMethods) self::RodaRequest.extend(plugin::RequestClassMethods) end if defined?(plugin::ResponseMethods) self::RodaResponse.send(:include, plugin::ResponseMethods) end if defined?(plugin::ResponseClassMethods) self::RodaResponse.extend(plugin::ResponseClassMethods) end if plugin.respond_to?(:configure) plugin.configure(self, *args, &block) end end