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.获取自定义内容,参 ...
随机推荐
- lintcode:将二叉树拆成链表
题目 将一棵二叉树按照前序遍历拆解成为一个假链表.所谓的假链表是说,用二叉树的 right 指针,来表示链表中的 next 指针. 注意事项 不要忘记将左儿子标记为 null,否则你可能会得到空间溢出 ...
- 1.BOM学习
1.bom.html <html> <head> <title>bom演示</title> <script type="text/jav ...
- Android基础之Activity launchMode详解
本文来自http://blog.csdn.net/liuxian13183/ ,引用必须注明出处! Activity的lauchmode,是基础的属性,但也是App优化必须掌握的知识,它约束了Acti ...
- Java 虚拟机体系结构
众所周知,Java源代码被编译器编译成class文件.而并不是底层操作系统可以直接执行的二进制指令(比如Windows OS的.exe文件).因此,我们需要有一种平台可以解释class文件并运行它.而 ...
- 机器人学 —— 轨迹规划(Configuration Space)
之前的轨迹规划中,我们只考虑了质点,没有考虑机器人的外形与结构.直接在obstacle map 中进行轨迹规划,然而世纪情况中,机器人有固定外形,可能会和障碍物发生碰撞.此情况下,我们针对机器人自由度 ...
- Case 架构的实际应用-1
We use testlink to manage cases, and the frame is below: Project Name -All Features(Modules) -Featur ...
- jpa+spring配置多数据源
property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test?useU ...
- 基于Linux的oracle数据库管理 part2( 数据库 准备,安装,创建 )
主要内容 1. 准备 2. 安装 与 删除 软件 3. 创建数据库 4. 配置 SQL*PLUS 环境 准备 1. 软件包, rpm –qa , rpm –ivh *.rpm 2. 检查磁盘空间 3. ...
- 用Maven插件生成Mybatis代码
现在代码管理基本上是采用Maven管理,Maven的好处此处不多说,大家用百度搜索会有很多介绍,本文介绍一下用Maven工具如何生成Mybatis的代码及映射的文件. 一.配置Maven pom.xm ...
- UVa 11090 Going in Cycle!!【Bellman_Ford】
题意:给出n个点m条边的加权有向图,求平均值最小的回路 自己想的是用DFS找环(真是too young),在比较找到各个环的平均权值,可是代码实现不了,觉得又不太对 后来看书= =好巧妙的办法, 使用 ...