Method: Unroller.watch_for_added_methods
- Defined in:
- lib/unroller.rb
.watch_for_added_methods(mod, filter = //, &block) ⇒ Object
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 |
# File 'lib/unroller.rb', line 734 def self.watch_for_added_methods(mod, filter = //, &block) mod.singleton_class.instance_eval do define_method :method_added_with_watch_for_added_methods do |name, *args| if name.to_s =~ filter puts "Method '#{name}' was defined at #{caller[0]}" end end alias_method_chain :method_added, :watch_for_added_methods, :create_target => true end yield if block_given? # mod.class.instance_eval do # alias_method :method_added, :method_added_without_watch_for_added_methods # end end |