Where did you get the syntax for your:
  +---------------------------------+
  | rdoc --main maindocpage rex.rb  |
  +---------------------------------+

The only thing you need is run rdoc without any arguments (parameters) 
in a directory where is your documented Ruby program; i.e.: cd into that 
directory! This command (rdoc) will create the HTML documentation in the 
"doc" directory in the same directory where you placed your "rex.rb" and 
where you have executed rdoc. in other words, after execution of rdoc 
look for "./doc/index.html". This is your main documentation page 
including all dependent Ruby files your "rex.rb" may have.

What you think is the "maindocpage" is most likely the initial 
documentation for your application, and it is part of the commented text 
in front of your "rex.rb".

rdoc extracts three different kinds of info from your Ruby file:

  * (1) header or main documentation at the very beginning immediately 
after the shebang
  * (2) any comments preceding all classes
  * (3) any comments before the methods you define

This means your Ruby programs must have the following format:

    +------------------------------------------+
01  | #!/usr/bin/env ruby                      |
02  |                                          | (1)
03  | # =Your Application Documentation        | <-- Main doc. what
04  | #                                        | you must likely
05  | # My application does this and that, and | mistakenly have
06  | # much more ......                       | in a separate
07  | #                                        | file (maindocpage)
08  | # ==Subtile #1                           |
09  | #                                        |
10  | # xyzxyzxyz xyzxyzxyz  xyzxy xyzxyzxyz x |
11  | # xyzxyzxyz xyzxyzxyz xyzxyzxyz xyzxyzxy |
12  | # xyzxyzxyz xyzx                         |
13  | #                                        | (2)
14  |                                          | <-- empty line
15  | # ==My First Class                       |  separates main
16  | # xyzxyzxyz xyzxyzxyz  xyzxy xyzxyzxyz x |  doc. from class
17  | # xyzxyzxyz xyzxyzxyz xyzxyzxyz xyzxyzxy |  docunentation
18  | # xyzxyzxyz xyzx                         |
19  |                                          |
20  | class MyFirstClass                       |
21  |   ...                                    |
22  |                                          | (3)
23  |   # This method does this and that, when | <-- Method doc
24  |   # you pass it both parameters ...      | preceding any
25  |                                          | methods defined
26  |   def a_method(p1, p2)                   | within a class
27  |   ...                                    |
28  |   end                                    |
29  | end                                      |
30  +------------------------------------------+
-- 
Posted via http://www.ruby-forum.com/.