From: Eric Hodel Date: 2010-05-11T08:34:44+09:00 Subject: Re: Question about rdoc (2.5.8) On May 10, 2010, at 13:25, byrnejb wrote: > The answer is probably 'No! Why on earth would you want to do that?' > but, I have to ask. Is there an Rdoc directive that forces an > arbitrary line of Ruby code into the document? > > I have this sort of thing in a Cucumber step_definition file: > > > When /this has to match/ do > > When /this also matches "(.*)"/ do |x| > > When /another match for (\d+)/ do /digit/ > > And I would like to just include the line beginning with 'When' into > the Rdoc file. However, I cannot seem to find any way of doing > this. You'll probably need to write a custom parser. The rdoc-rake gem has such a custom parser for Rakefiles you could look at for an example. > I verified that the the file get processed by Rdoc because I added a > section statement and that shows up. But, the only way I have > discovered to get the desired lines into the document is to extend the > section to include a comment for each step definition, which is hardly > DRY. > > It seemed to me that the meta-programming comment tag (##) might work > but it does not. And, further, all the comments in the file that > follow the first blank line in the section portion do not get > included, so that I cannot even keep the step_definition comments > directly above the associated step_definition statements. > > Any suggestions on how to deal with this are welcomed. Can you link to an example file you want RDoc to process?