Method: Cinch::Plugin::ClassMethods#call_hooks

Defined in:
lib/cinch/plugin.rb

#call_hooks(type, event, group, instance, args) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns True if processing should continue.

Returns:

  • (Boolean)

    True if processing should continue



321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/cinch/plugin.rb', line 321

def call_hooks(type, event, group, instance, args)
  stop = __hooks(type, event, group).find { |hook|
    # stop after the first hook that returns false
    if hook.method.respond_to?(:call)
      instance.instance_exec(*args, &hook.method) == false
    else
      instance.__send__(hook.method, *args) == false
    end
  }

  !stop
end