Generating documentation with RDoc
We’ll suppose that your application is a Rails application.
- Go to the root of your application
- Type rake doc:app
Syntaxes and Examples to do comments on your applications :
Text Decoration :
This method is a very critical one in our system. Please be careful!
The text above is bigger because I used 2 heading characters "==" before typing the actual comment. (It‘s like the h1, h2, h3 tags in HTML but instead you use =, ==, === and so on)
Ordering:- It takes 2 params
- We discard the 1st one
- We put "mister t" in the second one if nothing has been supplied.
Hyperlink :
RDoc also detects external links, like www.railsthinker.blogspot.com. If you prefer displaying a label instead of an URL address, use the label[url] format instead, like that : www.railsthinker.blogspot.com. If your label as more than 2 words (like in the example), put them inside curly braces, like that {Rock on!} [the url]
HTML basic formatting :
Finally, how about some HTML basic formatting? if it is just one word long, use * hello * for bold and _ hello _ for italic (just remove the spaces). Now if the thing to format is more than one word long, use the more traditionnal and <em> and <b> tags (just a nitpicky question though : Why "b" instead of "strong"?).
RDoc is not specific to Rails. Like I said earlier, it is a ruby library and thus you can use it in other contexts. I took Rails because I knew that the % of people using Ruby without Rails was rather small.