Class: PluginHooks
- Inherits:
-
Object
- Object
- PluginHooks
- Includes:
- Singleton
- Defined in:
- app/lib/plugin_hooks.rb
Class Method Summary collapse
Instance Method Summary collapse
- #components_for(hook) ⇒ Object
-
#initialize ⇒ PluginHooks
constructor
A new instance of PluginHooks.
- #register(hook, component) ⇒ Object
Constructor Details
#initialize ⇒ PluginHooks
Returns a new instance of PluginHooks.
4 5 6 |
# File 'app/lib/plugin_hooks.rb', line 4 def initialize @hooks = {} end |
Class Method Details
.register(hook, component) ⇒ Object
13 14 15 |
# File 'app/lib/plugin_hooks.rb', line 13 def self.register(hook, component) instance.register(hook, component) end |
Instance Method Details
#components_for(hook) ⇒ Object
17 18 19 |
# File 'app/lib/plugin_hooks.rb', line 17 def components_for(hook) @hooks[hook] || [] end |
#register(hook, component) ⇒ Object
8 9 10 11 |
# File 'app/lib/plugin_hooks.rb', line 8 def register(hook, component) @hooks[hook] ||= [] @hooks[hook] << component end |