LinuxCommandLibrary

rdoc

TLDR

Generate documentation

$ rdoc [file.rb]
copy
Generate for directory
$ rdoc [lib/]
copy
Generate with title
$ rdoc --title "[Project Name]" [lib/]
copy
Output to directory
$ rdoc -o [doc/] [lib/]
copy
Show help for class
$ ri [Array]
copy

SYNOPSIS

rdoc [options] [files...]

DESCRIPTION

RDoc generates documentation from Ruby source files. It parses comments and code structure to create HTML documentation or ri data files.

PARAMETERS

-o, --output dir

Output directory.
--title text
Documentation title.
-f, --format format
Output format (html, ri).
-m, --main file
Main page file.
-x, --exclude pattern
Exclude files.
-a, --all
Include all methods.

EXAMPLES

$ # Generate HTML docs
rdoc lib/

# With options
rdoc --title "My Gem" --main README.md lib/

# Generate ri data
rdoc -f ri lib/

# Exclude tests
rdoc -x test lib/

# View with ri
ri String#split
ri Array
copy

DOCUMENTATION FORMAT

$ # Main description of class
#
# == Usage
#   obj = MyClass.new
#
# @param name [String] the name
# @return [Boolean] success status
class MyClass
  # Method description
  def my_method(name)
  end
end
copy

CAVEATS

Part of Ruby standard library. Alternative: YARD for enhanced features.

HISTORY

RDoc was created by Dave Thomas for Ruby documentation, included in Ruby since version 1.8.

SEE ALSO

ri(1), yard(1), ruby(1)

Copied to clipboard