Method: Extlib::Hook::ClassMethods#before

Defined in:
lib/extlib/hook.rb

#before(target_method, method_sym = nil, &block) ⇒ Object

Note:

Either method_sym or block is required.

Inject code that executes before the target instance method.

-

Parameters:

  • target_method (Symbol)

    the name of the instance method to inject before

  • method_sym (Symbol) (defaults to: nil)

    the name of the method to run before the target_method

  • block (Block)

    the code to run before the target_method



94
95
96
# File 'lib/extlib/hook.rb', line 94

def before(target_method, method_sym = nil, &block)
  install_hook :before, target_method, method_sym, :instance, &block
end