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.获取自定义内容,参 ...
随机推荐
- 545B. Equidistant String
题目链接 输入两个只含有01的字符串,s,t 求一个字符串p使到s,t的距离一样 这里的距离是指对应位置:0-0的距离是0 ,o-1的距离是1 ,1-1的距离是0,1-0的距离是1 这里只要求找出满足 ...
- MYSQL 当有两条重复数据时 保留一条
delete from test where id in (select id from (select max(id) as id,count(text) as count from test ...
- Java 虚拟机体系结构
众所周知,Java源代码被编译器编译成class文件.而并不是底层操作系统可以直接执行的二进制指令(比如Windows OS的.exe文件).因此,我们需要有一种平台可以解释class文件并运行它.而 ...
- rqnoj-106-最大加权矩形-dp
和我之前做的那个切西瓜的题目相比就是小巫见大巫了.. 运用最长字段和的原理把O(n^4)转化成O(n^3) #include<stdio.h> #include<string.h&g ...
- Linux设备模型——设备驱动模型和sysfs文件系统解读
本文将对Linux系统中的sysfs进行简单的分析,要分析sysfs就必须分析内核的driver-model(驱动模型),两者是紧密联系的.在分析过程中,本文将以platform总线和spi主控制器的 ...
- oracle数据导入的常用命令
oracle 中数据库完全导入导出:cmd命令行模式 oracle数据库cmdfile数据库服务器constraints Oracle数据导入导出imp/exp就相当于oracle数据还原与备份.ex ...
- git和其他版本控制系统的区别
所有除了Git以外的版本控制系统都使用增量存储方式来保存不同版本,而Git则在每一个commit时,保存一个整个文件的content copy,除非那个文件没有做过改动.Git和其他版本系统的主要区别 ...
- git workflow常用命令
git init git status git add readme.txt git add --all Adds all new or modified files git comm ...
- JSAPI微信支付返回错误:fail_no permission to execute
问题描述 fail_no permission to execute 一定是授权目录出问题了,因为没有权限. 开发环境及可能造成的原因 这次的微信开发是用的Mvc4,支付的封装代码不会有问题(用过很多 ...
- HDU 1869 六度分离【floyd】
题意:给出n个人,m个关系,问是否满足任意两个人之间的距离通过6个人就可以连接 用floyd就可以了,注意距离是大于7 #include<iostream> #include<cst ...