Module: Flexor::Plugins::Dispatcher
- Included in:
- Flexor
- Defined in:
- lib/flexor/plugins.rb
Overview
Class-level methods for registering and loading plugins. Extended onto Flexor to provide .plugin and .register_plugin.
Instance Method Summary collapse
Instance Method Details
#plugin(mod) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/flexor/plugins.rb', line 14 def plugin(mod, ...) mod = resolve_plugin(mod) mod.before_load(self, ...) if mod.respond_to?(:before_load) include(mod::StoreMethods) if defined?(mod::StoreMethods) extend(mod::ClassMethods) if defined?(mod::ClassMethods) mod.after_load(self, ...) if mod.respond_to?(:after_load) nil end |
#plugin_registry ⇒ Object
25 26 27 |
# File 'lib/flexor/plugins.rb', line 25 def plugin_registry @plugin_registry ||= {} end |
#register_plugin(symbol, mod) ⇒ Object
10 11 12 |
# File 'lib/flexor/plugins.rb', line 10 def register_plugin(symbol, mod) Flexor.plugin_registry[symbol] = mod end |