Eric Hodel wrote:

> To have RDoc parse a chunk of ruby, call RDoc::RubyParser#scan.  This 
> will fill in the RDoc::TopLevel object you provide, but I don't know how 
> to pull the source back out.  Hunting through RDoc::Generator::HTML 
> might help there.

Here's what I was doing:

http://efficient-sql.rubyforge.org/

Notice how each feature (such as Throttle) has an exemplary test case. Then 
notice how I can't simply transclude the case in (following the ideal that test 
cases should document all your features). So I must say "See: 
ClassTest#test_case" for each feature instead.

Then to produce this...

http://www.oreillynet.com/ruby/blog/2008/01/assert_efficient_sql.html

...I had to manually copy the HTML out of the code samples and replace the 
"See:..." markers with it.

This is how far I got on the technical side:

   def test_ruby_parser
     top_level = RDoc::TopLevel.new(__FILE__)
     options = Options.instance
     parser = RDoc::RubyParser.new(top_level, 'file', 'muther :luvver', options, 0)
     file_info = parser.scan
     gen = Generators::HTMLGenerator.for(options)
#pp file_info
#doc gen
#puts    gen.generate([file_info])
#p gen.markup
   end  #  hence /usr/lib/ruby/1.8/rdoc/generators/html_generator.rb

> You may have to wrap your source up in some method, too.

That would seem follow from RDoc disregards top-level statements!

Now, shouldn't RDoc have some unit tests, showing how to call its interfaces?

-- 
   Phlip