Class: PluginHooks

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
app/lib/plugin_hooks.rb

Class Method Summary collapse

Instance Method Summary collapse

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