From: Sam Uel Date: 2010-05-18T23:45:23+09:00 Subject: Re: Dynamically adding methods to a class Rick Denatale wrote: > On Tue, May 18, 2010 at 9:13 AM, Sam Uel > wrote: >> puts fr.methods.include? "somefunc" >> puts Fred.new.methods.include? "somefunc" >> puts Fred.instance_methods.include? "somefunc" >> >> Gives the output: >>>>false >>>>false >>>>false > > Really? I ran your Test.rb program in its entirety and got the > following output: > > inside method_missing > 1st time - called by the var fr > 2nd time - called by the var fr > 3rd time, this one's a new instance > true > true > true > > > > > -- > Rick DeNatale > > Blog: http://talklikeaduck.denhaven2.com/ > Github: http://github.com/rubyredrick > Twitter: @RickDeNatale > WWR: http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn: http://www.linkedin.com/in/rickdenatale Yup, I run the code in its' entirety too. Perhaps I somehow screwed up my Ruby install? I was lazy I admit and didn't feel like reading up on how to install Ruby, so I just DLed the latest one found here: http://rubyinstaller.org/download.html Which version are you using, if you don't mind me asking? @Rob: you mean declaring Fred.new.somefunc before fr.somefunc? If so, no difference at the end - still just gives me three false. Thanks guys for your time! -- Posted via http://www.ruby-forum.com/.