Module: Hooker

Overview

Copyright

Copyright © 2005 Nicolas Pouillard. All rights reserved.

Author

Nicolas Pouillard <[email protected]>.

License

Gnu General Public License.

Revision

$Id: /w/fey/cmd/trunk/lib/hooker.rb 24388 2006-07-09T17:09:53.202920Z ertai $

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#hook_method(method, *hook_names) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hooker.rb', line 12

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
    instance_eval %Q{
      def #{hook_name} ( *a, &b )
        #{method}(*a, &b)
      end
    }
  end
end