public
Description: YARD is a Ruby Documentation tool (Yay!)
Home | Edit | New

Assumptions

YARD is quite configurable and extensible, but it does make certain assumptions, by default.
This page attempts to document these, using a simplified example.

Let’s say that our project’s source code is stored in the foo directory.
By default, yardoc will expect that:

  • it will be run in the foo directory
  • there will be a file named (something like :) README in the foo directory
  • there will be a lib directory in the foo directory
  • the lib directory will contain one or more *.rb files
  • at least one of the *.rb files will define a class or module
  • any methods to be documented will reside in a class or module
  • private and protected methods should not be documented

That is, something like the following directory tree:

foo/                            project directory
| lib/                          input Ruby file(s)
| | a.rb                        input Ruby file
| README                        input README file

After yardoc has been run, the directory tree will look something like:

foo/                            project directory
| .yardoc                       cached Registry information
| doc/                          documentation
| | A.html                      HTML for class/module A
| | all-methods.html            HTML index of methods 
| | all-namespaces.html         HTML index of namespaces (eg, classes) 
| | app.js                      JavaScript helper code
| | index.html                  HTML "wrapper" for page
| | jquery.js                   jQuery library
| | readme.html                 HTML version of README text
| | style.css                   CSS (generic)
| | syntax_highlight.css        CSS for syntax highlighting of source code
| lib/                          input Ruby file(s)
| | a.rb                        input Ruby file
| README                        input README file

Configuration

Here are some ways to configure yardoc to get different behavior;
run yardoc --help for more information:

documenting public, private, and/or protected methods

The --private and --protected options
cause yardoc to document the corresponding method types.
The --no-public option causes yardoc not to document public methods.

output directory

The option --output-dir PATH can be used to specify an output directory
other than the default (./doc).

README file

The --readme (-r) option allows an alternate README file to be specified.

Last edited by eclubb, Tue May 19 10:51:54 -0700 2009
Home | Edit | New
Versions: