Sha256: 3ade1178942b9fc7f4e51492dad38dd43985c6f5021fff6cbd30cf6788bca852
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved. # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>. # License:: Gnu General Public License. # Revision:: $Id: hooker.rb 208 2005-05-05 19:53:50Z ertai $ require 'rubygems' require_gem 'activesupport' require 'active_support/class_inheritable_attributes' module Hooker def self.included ( aClass ) super aClass.module_eval do class_inheritable_accessor :default_hook def self.hook_default_method ( method ) raise unless method.is_a? Symbol self.default_hook = method end def hook_method ( *a ) @@generic_hook_method[method(:instance_eval), *a] end def self.hook_method ( *a ) @@generic_hook_method[method(:module_eval), *a] end @@generic_hook_method = lambda do |eval_meth, method, *hook_names| raise unless method.is_a? Symbol hook_names.each do |hook_name| raise unless hook_name.is_a? Symbol eval_meth[%Q{ def #{hook_name} ( *a, &b ) #{method}(*a, &b) end }] end end end end end # module Hooker
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vcs-0.2.148 | ruby_ex/hooker.rb |