RDoc::Options
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.
Example:
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 end end end
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 end
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.
Constants
DEPRECATED = {\n'--accessor' => 'support discontinued',\n'--diagram' => 'support discontinued',\n'--help-output' => 'support discontinued',\n'--image-format' => 'was an option for --diagram',\n'--inline-source' => 'source code is now always inlined',\n'--merge' => 'ri now always merges class information',\n'--one-file' => 'support discontinued',\n'--op-name' => 'support discontinued',\n'--opname' => 'support discontinued',\n'--promiscuous' => 'files always only document their content',\n'--ri-system' => 'Ruby installers use other techniques',\n}
Directory = Object.new
Path = Object.new
PathArray = Object.new
SPECIAL = %w[\ncoverage_report\ndry_run\nencoding\nfiles\nforce_output\nforce_update\ngenerator\ngenerator_name\ngenerator_options\ngenerators\nop_dir\noption_parser\npipe\nrdoc_include\nroot\nstatic_path\nstylesheet_url\ntemplate\ntemplate_dir\nupdate_output_dir\nverbosity\nwrite_options\n]
Template = Object.new
Attributes
| [RW] | charset |
| [RW] | coverage_report |
| [RW] | dry_run |
| [RW] | encoding |
| [RW] | exclude |
| [RW] | files |
| [RW] | force_output |
| [RW] | force_update |
| [RW] | formatter |
| [RW] | generator |
| [R] | generator_name |
| [RW] | generator_options |
| [RW] | hyperlink_all |
| [RW] | line_numbers |
| [RW] | locale |
| [RW] | locale_dir |
| [RW] | main_page |
| [RW] | markup |
| [RW] | op_dir |
| [RW] | option_parser |
| [RW] | output_decoration |
| [RW] | page_dir |
| [RW] | pipe |
| [RW] | rdoc_include |
| [RW] | root |
| [RW] | show_hash |
| [RW] | static_path |
| [RW] | tab_width |
| [RW] | template |
| [RW] | template_dir |
| [RW] | template_stylesheets |
| [RW] | title |
| [RW] | update_output_dir |
| [RW] | verbosity |
| [R] | visibility |
| [RW] | webcvs |
Files
- lib/rdoc/options.rb