Method: Textbringer::Utils.add_hook

Defined in:
lib/textbringer/utils.rb

.add_hook(name, func = nil, local: false, &block) ⇒ Object



355
356
357
358
359
# File 'lib/textbringer/utils.rb', line 355

def add_hook(name, func = nil, local: false, &block)
  hooks = get_hooks(local)
  return if hooks[name].include?(func)
  hooks[name].unshift(func || block)
end