Ruby latest stable (v2_5_5) - 0 notes - Superclass: Object

RDoc::Options handles the parsing and storage of options

Saved Options

You can save some options like the markup format in the .rdoc_options file in your gem. The easiest way to do this is:

rdoc --markup tomdoc --write-options

Which will automatically create the file and fill it with the options you specified.

The following options will not be saved since they interfere with the user’s preferences or with the normal operation of RDoc:

  • --coverage-report

  • --dry-run

  • --encoding

  • --force-update

  • --format

  • --pipe

  • --quiet

  • --template

  • --verbose

Custom Options

Generators can hook into RDoc::Options to add generator-specific command line options.

When --format is encountered in ARGV, RDoc calls ::setup_options on the generator class to add extra options to the option parser. Options for custom generators must occur after --format. rdoc --help will list options for all installed generators.


class RDoc::Generator::Spellcheck
  RDoc::RDoc.add_generator self

  def self.setup_options rdoc_options
    op = rdoc_options.option_parser

    op.on('--spell-dictionary DICTIONARY',
          RDoc::Options::Path) do |dictionary|
      rdoc_options.spell_dictionary = dictionary

Of course, RDoc::Options does not respond to spell_dictionary by default so you will need to add it:

class RDoc::Options

  # The spell dictionary used by the spell-checking plugin.

  attr_accessor :spell_dictionary


Option Validators

OptionParser validators will validate and cast user input values. In addition to the validators that ship with OptionParser (String, Integer, Float, TrueClass, FalseClass, Array, Regexp, Date, Time, URI, etc.), RDoc::Options adds Path, PathArray and Template.


Template = Object.new

PathArray = Object.new

Path = Object.new

Directory = Object.new

SPECIAL = %w[ coverage_report dry_run encoding files force_output force_update generator generator_name generator_options generators op_dir option_parser pipe rdoc_include root static_path stylesheet_url template template_dir update_output_dir verbosity write_options ]

DEPRECATED = { '--accessor' => 'support discontinued', '--diagram' => 'support discontinued', '--help-output' => 'support discontinued', '--image-format' => 'was an option for --diagram', '--inline-source' => 'source code is now always inlined', '--merge' => 'ri now always merges class information', '--one-file' => 'support discontinued', '--op-name' => 'support discontinued', '--opname' => 'support discontinued', '--promiscuous' => 'files always only document their content', '--ri-system' => 'Ruby installers use other techniques', }


[R] visibility

Minimum visibility of a documented method. One of :public, :protected, :private or :nodoc.

The :nodoc visibility ignores all directives related to visibility. The other visibilities may be overridden on a per-method basis with the :doc: directive.

[RW] webcvs

URL of web cvs frontend

[RW] verbosity

Verbosity, zero means quiet

[RW] update_output_dir

Should RDoc update the timestamps in the output dir?

[RW] title

Documentation title

[RW] template_stylesheets

Additional template stylesheets

[RW] template_dir

Directory the template lives in

[RW] template

Template to be used when generating output

[RW] tab_width

The number of columns in a tab

[RW] static_path

Directory to copy static files from

[RW] show_hash

Include the ‘#’ at the front of hyperlinked instance method names

[RW] root

Root of the source documentation will be generated for. Set this when building documentation outside the source directory. Defaults to the current directory.

[RW] rdoc_include

Array of directories to search for files to satisfy an :include:

[RW] pipe

Is RDoc in pipe mode?

[RW] page_dir

Directory where guides, FAQ, and other pages not associated with a class live. You may leave this unset if these are at the root of your project.

[RW] output_decoration

Output heading decorations?

[RW] option_parser

The OptionParser for this instance

[RW] op_dir

The name of the output directory

[RW] coverage_report

If true, only report on undocumented files

[RW] markup

The default markup format. The default is ‘rdoc’. ‘markdown’, ‘tomdoc’ and ‘rd’ are also built-in.

[RW] main_page

Name of the file, class or module to display in the initial index page (if not specified the first file we encounter is used)

[RW] locale_dir

The directory where locale data live.

[RW] locale

The output locale.

[RW] line_numbers

Include line numbers in the source code

[RW] hyperlink_all

Old rdoc behavior: hyperlink all words that match a method name, even if not preceded by ‘#’ or ‘::’

[RW] generator_options

Loaded generator options. Used to prevent –help from loading the same options multiple times.

[R] generator_name

For #==

[RW] generator

Description of the output generator (set with the --format option)

[RW] formatter

Formatter to mark up text with

[RW] force_update

Scan newer sources than the flag file if true.

[RW] force_output

Create the output even if the output directory does not look like an rdoc output directory

[RW] files

The list of files to be processed

[RW] exclude

Files matching this pattern will be excluded

[RW] encoding

The output encoding. All input files will be transcoded to this encoding.

The default encoding is UTF-8. This is set via –encoding.

[RW] dry_run

If true, RDoc will not write any files.

[RW] charset

Character-set for HTML output. #encoding is preferred over #charset

Show files where this class is defined (1 file)
Register or log in to add new notes.