From: Rick DeNatale Date: 2010-05-19T00:02:09+09:00 Subject: Re: Dynamically adding methods to a class On Tue, May 18, 2010 at 10:45 AM, Sam Uel wrote: > 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? I'm guessing you are using Ruby 1.9, which would explain it. In Ruby 1.9 Object#messages returns an array of symbols, whereas Ruby 1.8 returns an array of strings. Try changing those last 3 lines to: puts fr.methods.include? :somefunc puts Fred.new.methods.include? " :somefunc puts Fred.instance_methods.include? :somefunc -- 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