class Gollum::Hook

Public Class Methods

execute(type, *args) click to toggle source
# File lib/gollum-lib/hook.rb, line 24
def execute(type, *args)
  type_hooks = @hooks[type]
  if type_hooks
    type_hooks.each_value do |block|
      block.call(*args)
    end
  end
end
get(type, id) click to toggle source
# File lib/gollum-lib/hook.rb, line 20
def get(type, id)
  @hooks.fetch(type, {})[id]
end
register(type, id, &block) click to toggle source
# File lib/gollum-lib/hook.rb, line 7
def register(type, id, &block)
  type_hooks     = @hooks[type] ||= {}
  type_hooks[id] = block
end
unregister(type, id) click to toggle source
# File lib/gollum-lib/hook.rb, line 12
def unregister(type, id)
  type_hooks = @hooks[type]
  if type_hooks
    type_hooks.delete(id)
    @hooks.delete(type) if type_hooks.empty?
  end
end