Daniel Bretoi wrote:
> 
> We seem to get different results. 
> [~]$ ruby -version
> ruby 1.6.8 (2002-12-24) [i386-linux]

Sorry about that, i'm on an older version:
$ ruby -v 
ruby 1.6.7 (2002-03-01) [i586-linux-gnu]
 
> 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?

All methods defined at the toplevel scope go into an Object as a private
method, IIRC.
From the Pickaxe:
 http://www.rubycentral.com/book/classes.html#S3
"At the top level, we're executing code in the context of some
predefined object. When we define methods, we're actually creating
(private) singleton methods for this object."

But then the Pickaxe was wrong on how that method worked, so YMMV :-)

As for mod_ruby, the code will be wrapped in an anonymous module. I am
uncertain how that affects respond_to? and where "toplevel" methods
go.   

-- 
(\[ 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___)