From: ts Date: 2003-07-07T19:54:29+09:00 Subject: Re: Help with UnboundMethod#bind error >>>>> "M" == Mauricio =?iso-8859-1?Q?Fern=E1ndez?= writes: M> The extension is easy to write (although you'll have to wait for Guy to M> check if my code is a time bomb :-): Well, I've sent in a private email the extension to "Pit Capitain". For me it has some problems : 1) you must know where a method is defined when you call ::override 2) it work actually for Class and not Module, it's easy to change it but you'll have the same problem than in [ruby-talk:72510] Imagine that you want to intercept the method #each for all Enumerable : instinctively you write module Enumerable overrive :each def each puts "before each" super end end Then you write [1, 2].each {|i| p i} and you'll see that it don't work because Array has defined #each You don't have these problems the way that matz do it, because you just write svg% cat b.rb #!./ruby module Enumerable def each:before puts "before each" end end [1, 2].each {|i| p i } {"a" => 1, "b" => 2}.each {|*i| p i } (1..2).each {|i| p i } svg% svg% b.rb before each 1 2 before each ["a", 1] ["b", 2] before each 1 2 svg% You just need to know the relation that it exist between classes (or classes and modules) and you have this information. Rather than know where a method is defined (information that you don't have fatally). Guy Decoux