
The Ruby Documenting Tool application enables you to view, edit and write comments in ruby source files in more convinient way.. The Ruby Documenting Tool follows Freedesktop.org and GNOME standards to provide integration with Desktop Environment.
You can start Ruby Documenting Tool in the following ways:
Open an ruby source file in Nautilus.
Choose Programming Ruby Documenting Tool from the Applications menu.
Run rudoto at the prompt in a terminal such as gnome-terminal, or from the Run Application dialogue.
When you start Ruby Documenting Tool, the following window is displayed.
The Ruby Documenting Tool window contains the following elements:
The menus on the menubar contain all of the commands that you need to work with comments in Ruby Documenting Tool.
The toolbar contains a subset of the commands that you can access from the menubar.
The display area displays tree of classes and their methods, Code preview window, Comment Editor and Comment Preview Window .
In Ruby Documenting Tool, you can perform the same action in several ways. For example, you can open a ruby source file in the following ways:
This manual ruby source files functionality from the menubar.
To open a ruby source file, perform the following steps:
Choose File Open.
In the Open ruby source file dialogue, select the file you want to open.
Click Open. Ruby Documenting Tool displays the name of the ruby source file in the titlebar of the window.
To open another ruby source file, choose File Open again. Ruby Documenting Tool opens each file in the same window.
If you try to open a ruby source file with format that Ruby Documenting Tool does not recognise, the application displays an error message.
You can navigate through a classes and methods as follows:
To view the next item, choose Navigate Next Object.
To view the previous item, choose Navigate Previous Object.
To view the parent object in the ruby source file, choose Navigate Parent Object.
To view the child object in the ruby source file, choose Navigate Child Object.
To display the page contents that are not currently displayed in the display area, use the following methods:
Use the arrow keys or space key on the keyboard.
Drag the display area by clicking with the middle mouse button somewhere in the ruby source file and then moving the mouse. For example, to scroll down the page, drag the display area upwards in the window.
Use the scrollbars on the window.
You can use the following methods to resize a page in the Ruby Documenting Tool display area:
To add new comment to method or class or edit existing simply time corresponding text and markup it
To copy a file, perform the following steps:
Choose File Save a Copy.
Type the new filename in the Filename text box in the Save a Copy dialogue.
If necessary, specify the location of the copied ruby source file. By default, copies are saved in your home directory.
Click Save.
To close a ruby source file, choose File Close.
If the window is the last Ruby Documenting Tool window open, the application exits.
Below is a list of all shortcuts present in Ruby Documenting Tool:
|
Shortcut |
Action |
|---|---|
|
CtrlO |
Open an existing ruby source file |
|
CtrlS |
Save a copy of the current ruby source file |
|
CtrlW |
Close file |
|
CtrlC |
Copy selection |
|
CtrlA |
Select All |
|
CtrlR |
Reload the ruby source file |
|
Page Up |
Go up at this page |
|
Page Down |
Go to down at this page |
|
F1 |
Help |
|
F11 |
Enter fullscreen mode |
|
AltF11 |
Leave fullscreen mode |
|
Control+ |
Expand Tree |
|
Control- |
Collapse Tree |
|
AltUp |
Go to the previous code object |
|
AltRight |
Go to the child code object |
|
AltDown |
Go to the next code object |
|
AltRight |
Go to the parent code object |
|
ControlB |
Make selected BOLD |
|
ControlI |
Make selected ITALIC |
|
ControlT |
Make selected TYPEWRITER |
|
ControlL |
Mark selected as list of items |
|
ControlD |
|
|
ControlN |
|
Below is information how to comment ruby code, that RDoc can form pretty documentation using Ruby Documenting Tool. Paragraphs are lines that share the left margin. Text indented past this margin are formatted verbatim.
If the window is the last Ruby Documenting Tool window open, the application exits.
[cat] small domestic animal
[+cat+] command to copy standard input
Labeled lists may also be produced by putting a double colon after the label. This sets the result in tabular form, so the descriptions all line up. This was used to create the ‘author’ block at the bottom of this description.
cat:: small domestic animal
+cat+:: command to copy standard input
= Level One Heading
== Level Two Heading
and so on
Rules (horizontal lines) are entered using three or more hyphens.
Names of classes, source files, and any method names containing an underscore or preceded by a hash character are automatically hyperlinked from comment text to their description.
Hyperlinks to the web starting http:, mailto:, ftp:, or www. are recognized. An HTTP url that references an external image file is converted into an inline IMG... . Hyperlinks starting ‘link:’ are assumed to refer to local files whose path is relative to the —op directory.
Hyperlinks can also be of the form label[url], in which case the label is used in the displayed text, and url is used as the target. If label contains multiple words, put it in braces: {multi word label}[url].
RDoc stops processing comments if it finds a comment line containing ‘#—’. This can be used to separate external from internal comments, or to stop a comment being associated with a method, class, or module. Commenting can be turned back on with a line that starts ‘#++’.
# Extract the age and calculate the
# date-of-birth.
#--
# FIXME: fails if the birthday falls on
# February 29th
#++
# The DOB is returned as a Time object.
def get_dob(person)
...
:section: title
Starts a new section in the output. The title following
:section: is used as the section heading, and the remainder of the comment containing the section is used as introductory text. Subsequent methods, aliases, attributes, and classes will be documented in this section. A :section: comment block may have one or more lines before the :section: directive. These will be removed, and any identical lines at the end of the block are also removed. This allows you to add visual cues such as
# ----------------------------------------
# :section: My Section
# This is the section that I wrote.
# See it glisten in the noon-day sun.
# ----------------------------------------
call-seq:
lines up to the next blank line in the comment are treated as the method‘s calling sequence, overriding the default parsing of method parameters and yield arguments.
:include:filename
include the contents of the named file at this point. The file will be searched for in the directories listed by the —include option, or in the current directory by default. The contents of the file will be shifted to have the same indentation as the ’:’ at the start of the :include: directive.
:title:text
Sets the title for the document. Equivalent to the —title command line parameter. (The command line parameter overrides any :title: directive in the source).
:enddoc:
Document nothing further at the current level.
:main:name
Equivalent to the —main command line parameter.
:stopdoc: / :startdoc:
Stop and start adding new documentation elements to the current container. For example, if a class has a number of constants that you don‘t want to document, put a :stopdoc: before the first, and a :startdoc: after the last. If you don‘t specifiy a :startdoc: by the end of the container, disables documentation for the entire class or module.