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."

batsman@tux-chan:~/src/cvs/ruby$ irb
irb(main):001:0> def bla
irb(main):002:1> end
=> nil
irb(main):003:0> p respond_to? "bla"
true
=> nil
irb(main):004:0>
batsman@tux-chan:~/src/cvs/ruby$ irb1.7
irb(main):001:0> def bla
irb(main):002:1> end
nil
irb(main):003:0> p respond_to? "bla"
(irb):3: warning: parenthesize argument(s) for future version
false
nil
irb(main):004:0> p respond_to? "bla", true
(irb):4: warning: parenthesize argument(s) for future version
true
nil
irb(main):005:0> p respond_to?("bla", true)
true
nil

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Turn right here. No! NO! The OTHER right!