RDoc
RDoc - Ruby Documentation System
- home
- rdoc
- bugs
- code quality
Description
RDoc produces HTML and command-line documentation for Ruby projects. RDoc includes the rdoc
and ri
tools for generating and displaying documentation from the command-line.
Generating Documentation
Once installed, you can create documentation using the rdoc
command
$ rdoc [options] [names...]
For an up-to-date option summary, type
$ rdoc --help
A typical use might be to generate documentation for a package of Ruby source (such as RDoc itself).
$ rdoc
This command generates documentation for all the Ruby and C source files in and below the current directory. These will be stored in a documentation tree starting in the subdirectory doc
.
You can make this slightly more useful for your readers by having the index page contain the documentation for the primary file. In our case, we could type
% rdoc --main README.rdoc
You'll find information on the various formatting tricks you can use in comment blocks in the documentation this generates.
RDoc uses file extensions to determine how to process each file. File names ending .rb
and .rbw
are assumed to be Ruby source. Files ending .c
are parsed as C files. All other files are assumed to contain just Markup-style markup (with or without leading '#' comment markers). If directory names are passed to RDoc, they are scanned recursively for C and Ruby source files only.
To generate documentation using rake
see RDoc::Task.
To generate documentation programmatically:
gem 'rdoc'
require 'rdoc/rdoc' options = RDoc::Options.new
# see RDoc::Options rdoc = RDoc::RDoc.new
rdoc.document options
# see RDoc::RDoc
Writing Documentation
To write documentation for RDoc place a comment above the class, module, method, constant, or attribute you want documented:
##
# This class represents an arbitrary shape by a series of points. class Shape ##
# Creates a new shape described by a +polyline+.
#
# If the +polyline+ does not end at the same point it started at the
# first pointed is copied and placed at the end of the line.
#
# An ArgumentError is raised if the line crosses itself, but shapes may
# be concave. def initialize polyline
# ...
end end
The default comment markup format is the RDoc::Markup format. TomDoc, Markdown and RD format comments are also supported. You can set the default comment format for your entire project by creating a .rdoc_options
file. See Saved Options at RDoc::Options for instructions on creating one. You can also set the comment format for a single file through the :markup:
directive, but this is only recommended if you wish to switch markup formats. See Other directives at RDoc::Markup.
Comments can contain directives that tell RDoc information that it cannot otherwise discover through parsing. See Directives at RDoc::Markup to control what is or is not documented, to define method arguments or to break up methods in a class by topic. See RDoc::Parser::Ruby for directives used to teach RDoc about metaprogrammed methods.
See RDoc::Parser::C for documenting C extensions with RDoc.
To determine how well your project is documented run rdoc -C lib
to get a documentation coverage report. rdoc -C1 lib
includes parameter names in the documentation coverage report.
Bugs
See Bugs at CONTRIBUTING for information on filing a bug report. It's OK to file a bug report for anything you're having a problem with. If you can't figure out how to make RDoc produce the output you like that is probably a documentation bug.
License
RDoc is Copyright © 2001-2003 Dave Thomas, The Pragmatic Programmers. Portions © 2007-2011 Eric Hodel. Portions copyright others, see individual files and LEGAL.rdoc for details.
RDoc is free software, and may be redistributed under the terms specified in LICENSE.rdoc.
Warranty
This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.
RDoc的更多相关文章
- Vagrant基础简要记录
Vagrant是一种开源软件,它为跨众多操作系统构建可重复的开发环境提供了一种方法.Vagrant使用提供者(provider)来启动隔离的虚拟环境.默认的提供者是Virtualbox Vagrant ...
- Redis集群研究和实践(基于redis 3.0.5)
前言 redis 是我们目前大规模使用的缓存中间件,由于它强大高效而又便捷的功能,得到了广泛的使用.现在的2.x的稳定版本是2.8.19,也是我们项目中普遍用到的版本. redis在年初发布了3.0. ...
- Redis之个人简单理解
1.什么是redis? 在过去的几年中,NoSQL数据库一度成为高并发.海量数据存储解决方案的代名词,与之相应的产品也呈现出雨后春笋般的生机.然而在众多产品中能够脱颖而出的却屈指可数,如Redis.M ...
- CocoaPod 使用方法
huangyichengdeMacBook-Pro:~ Jack$ pod search AFNetworking/Library/Ruby/Site/2.0.0/rubygems.rb:250:in ...
- Ruby之基础介绍(二)
前言 上一篇我们简单介绍了下Ruby,这一节我们开始正式步入Ruby的世界,一探究竟. Ruby特点 (1)面向对象支持. (2)动态语言:我们可以修改已经定义过的类,也可以为现有类添加实例方法. ( ...
- 搭建高可用的redis集群,避免standalone模式带给你的苦难
现在项目上用redis的话,很少说不用集群的情况,毕竟如果生产上只有一台redis会有极大的风险,比如机器挂掉,或者内存爆掉,就比如我们生产环境 曾今也遭遇到这种情况,导致redis内存不够挂掉的情况 ...
- Array类
class Array Arrays are ordered, integer-indexed collections of any object. Array indexing starts at ...
- redmine computed custom field formula tips
项目中要用到Computed custom field插件,公式不知道怎么写,查了些资料,记录在这里. 1.http://apidock.com/ruby/Time/strftime 查看ruby的字 ...
- Redmine开发帮助
这里先零星记录二次开发用得上的知识点: 1.windows下开发环境,参考此文.最好使用rubyinstaller安装,注意选择版本.或者直接安装railsinstaller. 2.获取自定义内容,参 ...
随机推荐
- 在linux/unix中查找大文件
在linux/unix中查找大文件,如查找大于100M文件的位置路径,查找等于10M文件的位置路径等等,下面就介绍几个实现快速查找的命令: 1. 查找指定目录下所有大于100M的文件,命令为 find ...
- Shell脚本基础II
1.shell算术运算 1)加法 r=`expr 4 + 5`(注意! '4' '+' '5' 这三者之间要有空白) r=$[ 4 + 5 ] r=$(( 4 + 5 )) echo $r 2)乘法 ...
- eclipse 代码格式化 行宽设置
windows--preferences--java--code style--formatter--edit--line wrapping--maximum line width
- QQ群共享文件下载很慢解决办法
QQ群共享文件下载很慢解决办法.我们经常会不群里面共享文件,文件文件稍大,下载非常慢.家庭是20M的网速,一般正常下载能够达到2.5MB左右,而在QQ群实际下载网速却只有80KB左右.如果要下1G,就 ...
- QT5.3无法自动调用incomingConnection函数的问题(4.7没有这个问题)
最近将qt4.7的一个工程移到5.3,遇到了几个麻烦事,主要是这个incomingConnection监听后无法自动调用的问题,在4.7上是完全没有问题的,到了5.3就不行,网上也查了下,网友们都是放 ...
- 常见的css3缩放效果
transform的属性scale(x,y) 对元素进行缩放,x表示水平方向缩放倍数,y表示垂直方向的缩放倍数,y是可选参数,不设置,则表示两个方向的倍数是一样的,基点一样在元素的中心位置. 还有单向 ...
- 高斯判别分析 Gaussian Discriminant Analysis
如果在我们的分类问题中,输入特征xx是连续型随机变量,高斯判别模型(Gaussian Discriminant Analysis,GDA)就可以派上用场了. 以二分类问题为例进行说明,模型建立如下: ...
- 不带缓存的I/O和标准(带缓存的)I/O
首先,先稍微了解系统调用的概念: 系统调用,英文名system call,每个操作系统都在内核里有一些内建的函数库,这些函数可以用来完成一些系统系统调用把应用程序的请求传给内核,调用相应的 ...
- 通过从代码层面分析Linux内核启动来探知操作系统的启动过程
通过从代码层面分析Linux内核启动来探知操作系统的启动过程 前言说明 本篇为网易云课堂Linux内核分析课程的第三周作业,我将围绕Linux 3.18的内核中的start_kernel到init进程 ...
- flex 生命周期 ibm引用
Flex 本质 提起 Flex 我们不得不追述其发展历史以及两个很重要的名词或者说技术,那就是 Flash 和 Flash Player.Flash 是 Adobe 推出的基于时间轴的交互式矢量图和 ...