Module: Cuniculus::Plugins
- Defined in:
- lib/cuniculus/plugins.rb,
lib/cuniculus/plugins/health_check.rb
Overview
Base plugin load and registration module.
Defined Under Namespace
Modules: HealthCheck
Class Method Summary collapse
-
.load_plugin(name) ⇒ Module
Method that loads a plugin file.
-
.register_plugin(name, mod) ⇒ Object
Include plugin module into a Hash so it can be referenced by its name.
Class Method Details
.load_plugin(name) ⇒ Module
Method that loads a plugin file. It should not be called directly; instead use Cuniculus.plugin method to add and configure a plugin.
16 17 18 19 20 21 22 23 |
# File 'lib/cuniculus/plugins.rb', line 16 def self.load_plugin(name) h = @plugins unless plugin = h[name] require "cuniculus/plugins/#{name}" raise Cuniculus::Error, "Plugin was not registered with 'register_plugin'" unless plugin = h[name] end plugin end |
.register_plugin(name, mod) ⇒ Object
Include plugin module into a Hash so it can be referenced by its name. This method should be called by the plugin itself, so that when it is required (by load_plugin), it can be found.
41 42 43 |
# File 'lib/cuniculus/plugins.rb', line 41 def self.register_plugin(name, mod) @plugins[name] = mod end |