# Question about rdoc (2.5.8)

**URL:** <https://www.ruby-forum.com/t/question-about-rdoc-2-5-8/188361>\
**Category:** Ruby\
**Created:** [May 10, 2010, 10:28pm UTC](https://www.ruby-forum.com/t/question-about-rdoc-2-5-8/188361 "2010-05-10T22:28:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [May 10, 2010, 10:28pm UTC](https://www.ruby-forum.com/t/question-about-rdoc-2-5-8/188361/1 "2010-05-10T22:28:39Z")

</div>

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.

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.

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [May 11, 2010, 1:35am UTC](https://www.ruby-forum.com/t/question-about-rdoc-2-5-8/188361/2 "2010-05-11T01:35:24Z")

</div>

On May 10, 2010, at 13:25, byrnejb wrote:

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

> 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?

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [May 11, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/question-about-rdoc-2-5-8/188361/3 "2010-05-11T18:18:14Z")

</div>

On May 10, 7:34 pm, Eric H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

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

. . .

> Can you link to an example file you want RDoc to process?

Is a gist ok or do you need an actual file to download?

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [May 11, 2010, 10:22pm UTC](https://www.ruby-forum.com/t/question-about-rdoc-2-5-8/188361/4 "2010-05-11T22:22:57Z")

</div>

On May 11, 2010, at 09:17 , byrnejb wrote:

> > Can you link to an example file you want RDoc to process?
> 
> Is a gist ok or do you need an actual file to download?

the gist is fine. anything you can convey will work.

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [May 17, 2010, 8:07pm UTC](https://www.ruby-forum.com/t/question-about-rdoc-2-5-8/188361/5 "2010-05-17T20:07:27Z")

</div>

On May 11, 4:20 pm, Ryan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
you need an actual file to download?

> the gist is fine. anything you can convey will work.

[http://gist.github.com/404024](http://gist.github.com/404024)

What I would like to see in the generated rdoc file from this is  
something like:

cucumber\_steps matchers

The following matchers are available

When /display the current page/ do

When /do log the sql/ do

When /visits? (?:an?|the) application URL/i do

* * *

tag for search: byrnejb

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [May 17, 2010, 8:08pm UTC](https://www.ruby-forum.com/t/question-about-rdoc-2-5-8/188361/6 "2010-05-17T20:08:02Z")

</div>

On May 11, 4:20 pm, Ryan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
you need an actual file to download?

> the gist is fine. anything you can convey will work.

[http://gist.github.com/404024](http://gist.github.com/404024)

What I would like to see in the generated rdoc file from this is  
something like:

cucumber\_steps matchers

The following matchers are available

When /display the current page/ do

When /do log the sql/ do

When /visits? (?:an?|the) application URL/i do

* * *

tag for search: byrnejb
