From: Daniel Bretoi Date: 2003-02-14T05:06:03+09:00 Subject: Re: respond_to? in mod_ruby We seem to get different results. [~]$ ruby -version ruby 1.6.8 (2002-12-24) [i386-linux] irb(main):001:0> def blah irb(main):002:1> end => nil irb(main):003:0> p respond_to? "blah" true => nil After doing a p private_methods, every single method in my mod_ruby scripts show up as private, even though non have been declared as such. Is this a safety feature of mod_ruby? db On Thu, Feb 13, 2003 at 05:48:04PM +0900, Kent Dahl wrote: > Daniel Bretoi wrote: > > > > <% > > def blah > > end > > p respond_to? "blah" > > %> > > > > ==> false > > > > anyone know why? And how to get around? > > $ irb > irb(main):001:0> def blah > irb(main):002:1> end > nil > irb(main):003:0> p respond_to? "blah" > false > nil > > Doesn't look to me like mod_ruby is part of the problem equation > atleast. > > def blah > end > p self.respond_to? "blah", true > > From > http://www.rubycentral.com/book/ref_c_object.html#Object.respond_to_qm > "Private methods are included in the search only if the optional second > parameter evaluates to true." > > HTH > > -- > (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ > ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 5. year ) > ( \__\_?|?_/__/ ) _)Industrial economics and technological management( > \____/_?_\____/ (____engineering.discipline_=_Computer::Technology___) -- Feb 13* Be happy, It's Adar ! Feb 13* Rosh Chodesh Adar (Beginning of the month of Adar)