Class: Jerakia::Lookup::PluginFactory
- Inherits:
-
Object
- Object
- Jerakia::Lookup::PluginFactory
- Defined in:
- lib/jerakia/lookup/pluginfactory.rb
Instance Method Summary collapse
- #create_plugin_method(name, &block) ⇒ Object
-
#initialize ⇒ PluginFactory
constructor
A new instance of PluginFactory.
- #register(name, plugin) ⇒ Object
Constructor Details
#initialize ⇒ PluginFactory
Returns a new instance of PluginFactory.
3 4 5 |
# File 'lib/jerakia/lookup/pluginfactory.rb', line 3 def initialize Jerakia.log.debug("Loaded plugin handler") end |
Instance Method Details
#create_plugin_method(name, &block) ⇒ Object
8 9 10 |
# File 'lib/jerakia/lookup/pluginfactory.rb', line 8 def create_plugin_method(name, &block) self.class.send(:define_method, name, &block) end |
#register(name, plugin) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/jerakia/lookup/pluginfactory.rb', line 12 def register(name,plugin) require "jerakia/lookup/plugin/#{name}" plugin.activate(name) create_plugin_method(name) do plugin end end |