Module | Extlib::Hook::ClassMethods |
In: |
lib/extlib/hook.rb
|
Inject code that executes after the target instance method.
@param target_method<Symbol> the name of the instance method to inject after @param method_sym<Symbol> the name of the method to run after the
target_method
@param block<Block> the code to run after the target_method
@note
Either method_sym or block is required.
- @api public
Inject code that executes after the target class method.
@param target_method<Symbol> the name of the class method to inject after @param method_sym<Symbol> the name of the method to run after the target_method @param block<Block> the code to run after the target_method
@note
Either method_sym or block is required.
- @api public
Inject code that executes before the target instance method.
@param target_method<Symbol> the name of the instance method to inject before @param method_sym<Symbol> the name of the method to run before the
target_method
@param block<Block> the code to run before the target_method
@note
Either method_sym or block is required.
- @api public
Inject code that executes before the target class method.
@param target_method<Symbol> the name of the class method to inject before @param method_sym<Symbol> the name of the method to run before the
target_method
@param block<Block> the code to run before the target_method
@note
Either method_sym or block is required.
- @api public
Defines two methods. One method executes the before hook stack. The other executes the after hook stack. This method will be called many times during the Class definition process. It should be called for each hook that is defined. It will also be called when a hook is redefined (to make sure that the arity hasn‘t changed).
Generates names for the various utility methods. We need to do this because the various utility methods should not end in = so, while we‘re at it, we might as well get rid of all punctuation.
Returns the correct HOOKS Hash depending on whether we are working with class methods or instance methods
Returns ruby code that will invoke the hook. It checks the arity of the hook method and passes arguments accordingly.
Register a class method as hookable. Registering a method means that before hooks will be run immediately before the method is invoked and after hooks will be called immediately after the method is invoked.
@param hookable_method<Symbol> The name of the class method that should
be hookable
- @api public
Registers a method as hookable. Registering hooks involves the following process
Register aninstance method as hookable. Registering a method means that before hooks will be run immediately before the method is invoked and after hooks will be called immediately after the method is invoked.
@param hookable_method<Symbol> The name of the instance method that should
be hookable
- @api public