Module: Hooker::ClassMethods

Defined in:
lib/hooker.rb

Instance Method Summary collapse

Instance Method Details

#hook_default_method(method) ⇒ Object



26
27
28
29
# File 'lib/hooker.rb', line 26

def hook_default_method method
  raise unless method.is_a? Symbol
  self.default_hook = method
end

#hook_method(method, *hook_names) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/hooker.rb', line 32

def hook_method method, *hook_names
  raise unless method.is_a? Symbol
  hook_names.each do |hook_name|
    raise unless hook_name.is_a? Symbol
    module_eval %Q{
      def #{hook_name} ( *a, &b )
        #{method}(*a, &b)
      end
    }
  end
end