Method: DataMapper::Hook::ClassMethods#before_class_method

Defined in:
lib/dm-core/support/hook.rb

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

Note:

Either method_sym or block is required.

Inject code that executes before the target class method.

-

Parameters:

  • target_method (Symbol)

    the name of the class 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



56
57
58
# File 'lib/dm-core/support/hook.rb', line 56

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