From: "David A. Black" Date: 2005-09-10T22:16:06+09:00 Subject: Re: method_added for class methods Hi -- On Sat, 10 Sep 2005, Robert Klemme wrote: > David A. Black wrote: >> Hi -- >> >> On Sat, 10 Sep 2005, Trans wrote: >> >>> class X >>> class << self >>> def method_added(*args) >>> p args >>> end >>> def singletin_method_added(*args) >> >> s/tin/ton/ :-) >> >>> p args >>> end >>> end >>> end >> >> I believe that only the singleton_method_added actually does anything. >> I guess that's because the only methods you can add to this class are >> singletons, and that gets priority. >> >> At least, when I tried method_added, I couldn't get any output. > > Worksforme: > >>> class Bar >>> class <>> def x() end >>> end > :x > => nil Right -- actually the one that I expected would work, but didn't, was a different one, and I got my wires crossed. Here it is: class C class << self def self.method_added(m) p m end def x end end end David -- David A. Black dblack@wobblini.net