From: David Chelimsky Date: 2006-07-13T23:01:04+09:00 Subject: Re: re-define class method On Jul 13, 2006, at 7:47 AM, Sean O'Halpin wrote: > On 7/13/06, David Chelimsky wrote: >> On Jul 13, 2006, at 5:33 AM, dblack@wobblini.net wrote: >> > Don't forget that you can do this much more concisely (unless >> you have >> > a specific need to go the long way round): >> > >> > def Thing.class_method >> > "replaced" >> > end > > You can use David's method like this: > > def redefine_method_for(klass) > def klass.class_method > "replaced" > end > end > > redefine_method_for Thing > > p Thing.class_method > #=> "replaced" Unfortunately (actually, rather fortunately ;) ), both the class and the method name are determined at run time. David's dynamic suggestion (elsewhere in this thread) is working quite well. Cheers, and thanks for the help! David