From: Robert Dober Date: 2010-05-18T22:57:20+09:00 Subject: Re: Dynamically adding methods to a class On Tue, May 18, 2010 at 3:13 PM, Sam Uel wrote: > > ^^ Notice how the message "inside method_missing" only shows up once. Well it is not missing anymore as you define it when it is missing, it is not defined temporarily. > > Everything is OK so far, the method somefunc seems to have correctly > added itself as an instance method to the class Fred.. but the following > confuses me: > > puts fr.methods.include? "somefunc" > puts Fred.new.methods.include? "somefunc" > puts Fred.instance_methods.include? "somefunc" And what if you call Fred.new.somefunc first? >HTH R -- The best way to predict the future is to invent it. -- Alan Kay