键入 rdoc 命令,将会生成一个doc目录,将当前目录下的ruby和c文件,生成文档,放入doc目录。
代码中的注释可以很自然的书写,文本缩进进去,保证格式能够应用。使用:
# Determine the letters in a word or phrase # # * all letters are converted to lower case # * anything not a letter is stripped out # * the letters are converted into an array # * the array is sorted # * the letters are joined back into a string
这 '*' '-'标记的注释,将会成为无序列表, 1. 2.等标记将成为有序列列表注释。
使用:
# Determine the letters in a word or phrase # # [cat] 小猫 # [+cat+] 复制 def letters_of3(text) text.downcase.delete('^a-z').split('').sort.join end
这将生成标签描述列表,cat普通标签描述列表,[+cat+],标签则使用印刷体。
Rdoc默认会生成当前目录下的所有ruby和c源文件及其他描述性文件,但有时我们可能并不想生成所有文件的文档,可以创建一个.document文件,只有这个文件里有的文件,才会被生成文档。