Module: Hookable::Internal

Defined in:
lib/hookable.rb

Class Method Summary collapse

Class Method Details

.hook_trigger(hooker, name, *args, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/hookable.rb', line 10

def hook_trigger hooker, name, *args, &block
  if hooker.respond_to?(name)
    hooker.send(name, *args, &block)
  else
    if hooker.respond_to? :default_hook and not hooker.default_hook.nil?
      hooker.send(hooker.default_hook, name, *args, &block)
    elsif hooker.respond_to? :method_missing
      hooker.send(name, *args, &block)
    end
  end
end