Method: Doing::Hooks.register_one

Defined in:
lib/doing/hooks.rb

.register_one(event, priority, &block) ⇒ Object

register a single hook to be called later, internal API



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/doing/hooks.rb', line 37

def self.register_one(event, priority, &block)
  unless @registry[event]
    raise Doing::Errors::HookUnavailable, "Invalid hook. Doing only supports #{@registry.keys.inspect}"
  end

  raise Doing::Errors::PluginUncallable, 'Hooks must respond to :call' unless block.respond_to? :call

  Doing.logger.debug('Hook Manager:', "Registered #{event} hook") if ENV['DOING_PLUGIN_DEBUG']

  insert_hook event, priority, &block
end