Module | Options::OptionList
In: | rdoc/options.rb

### Methods

error help_output options strip_output usage

### Constants

OPTION_LIST | = | [ [ "--accessor", "-A", "accessorname[,..]", "comma separated list of additional class methods\n" + "that should be treated like 'attr_reader' and\n" + "friends. Option may be repeated. Each accessorname\n" + "may have '=text' appended, in which case that text\n" + "appears where the r/w/rw appears for normal accessors."], [ "--all", "-a", nil, "include all methods (not just public)\nin the output" ], [ "--charset", "-c", "charset", "specifies HTML character-set" ], [ "--debug", "-D", nil, "displays lots on internal stuff" ], [ "--diagram", "-d", nil, "Generate diagrams showing modules and classes.\n" + "You need dot V1.8.6 or later to use the --diagram\n" + "option correctly. Dot is available from\n"+ "http://www.research.att.com/sw/tools/graphviz/" ], [ "--exclude", "-x", "pattern", "do not process files or directories matching\n" + "pattern. Files given explicitly on the command\n" + "line will never be excluded." ], [ "--extension", "-E", "new=old", "Treat files ending with .new as if they ended with\n" + ".old. Using '-E cgi=rb' will cause xxx.cgi to be\n" + "parsed as a Ruby file"], [ "--fileboxes", "-F", nil, "classes are put in boxes which represents\n" + "files, where these classes reside. Classes\n" + "shared between more than one file are\n" + "shown with list of files that sharing them.\n" + "Silently discarded if --diagram is not given\n" + "Experimental." ], [ "--fmt", "-f", "format name", "set the output formatter (see below)" ], [ "--help", "-h", nil, "you're looking at it" ], [ "--help-output", "-O", nil, "explain the various output options" ], [ "--image-format", "-I", "gif/png/jpg/jpeg", "Sets output image format for diagrams. Can\n" + "be png, gif, jpeg, jpg. If this option is\n" + "omitted, png is used. Requires --diagram." ], [ "--include", "-i", "dir[,dir...]", "set (or add to) the list of directories\n" + "to be searched when satisfying :include:\n" + "requests. Can be used more than once." ], [ "--inline-source", "-S", nil, "Show method source code inline, rather\n" + "than via a popup link" ], [ "--line-numbers", "-N", nil, "Include line numbers in the source code" ], [ "--main", "-m", "name", "'name' will be the initial page displayed" ], [ "--merge", "-M", nil, "when creating ri output, merge processed classes\n" + "into previously documented classes of the name name"], [ "--one-file", "-1", nil, "put all the output into a single file" ], [ "--op", "-o", "dir", "set the output directory" ], [ "--opname", "-n", "name", "Set the 'name' of the output. Has no\n" + "effect for HTML." ], [ "--promiscuous", "-p", nil, "When documenting a file that contains a module\n" + "or class also defined in other files, show\n" + "all stuff for that module/class in each files\n" + "page. By default, only show stuff defined in\n" + "that particular file." ], [ "--quiet", "-q", nil, "don't show progress as we parse" ], [ "--ri", "-r", nil, "generate output for use by 'ri.' The files are\n" + "stored in the '.rdoc' directory under your home\n"+ "directory unless overridden by a subsequent\n" + "--op parameter, so no special privileges are needed." ], [ "--ri-site", "-R", nil, "generate output for use by 'ri.' The files are\n" + "stored in a site-wide directory, making them accessible\n"+ "to others, so special privileges are needed." ], [ "--ri-system", "-Y", nil, "generate output for use by 'ri.' The files are\n" + "stored in a system-level directory, making them accessible\n"+ "to others, so special privileges are needed. This option\n"+ "is intended to be used during Ruby installations" ], [ "--show-hash", "-H", nil, "A name of the form #name in a comment\n" + "is a possible hyperlink to an instance\n" + "method name. When displayed, the '#' is\n" + "removed unless this option is specified" ], [ "--style", "-s", "stylesheet url", "specifies the URL of a separate stylesheet." ], [ "--tab-width", "-w", "n", "Set the width of tab characters (default 8)"], [ "--template", "-T", "template name", "Set the template used when generating output" ], [ "--title", "-t", "text", "Set 'txt' as the title for the output" ], [ "--version", "-v", nil, "display RDoc's version" ], [ "--webcvs", "-W", "url", "Specify a URL for linking to a web frontend\n" + "to CVS. If the URL contains a '\%s', the\n" + "name of the current file will be substituted;\n" + "if the URL doesn't contain a '\%s', the\n" + "filename will be appended to it." ], ]

### Public Class methods

error(msg)

Show an error and exit

[Source]

    # File rdoc/options.rb, line 256
        def OptionList.error(msg)
          $stderr.puts
          $stderr.puts msg
          $stderr.puts "\nFor help on options, try 'rdoc --help'\n\n"
          exit 1
        end

help_output()

[Source]

    # File rdoc/options.rb, line 314
        def OptionList.help_output
          OptionList.strip_output("How RDoc generates output depends on the output formatter being\nused, and on the options you give.\n\n- HTML output is normally produced into a number of separate files\n(one per class, module, and file, along with various indices).\nThese files will appear in the directory given by the --op\noption (doc/ by default).\n\n- XML output by default is written to standard output. If a\n--opname option is given, the output will instead be written\nto a file with that name in the output directory.\n\n- .chm files (Windows help files) are written in the --op directory.\nIf an --opname parameter is present, that name is used, otherwise\nthe file will be called rdoc.chm.\n\nFor information on other RDoc options, use \"rdoc --help\".\n")
          exit 0
        end

options()

[Source]

    # File rdoc/options.rb, line 236
        def OptionList.options
          OPTION_LIST.map do |long, short, arg,|
            [ long,
              short,
              arg ? GetoptLong::REQUIRED_ARGUMENT : GetoptLong::NO_ARGUMENT
            ]
          end
        end

strip_output(text)

[Source]

    # File rdoc/options.rb, line 246
        def OptionList.strip_output(text)
          text =~ /^\s+/
          leading_spaces = $&
          text.gsub!(/^#{leading_spaces}/, '')
          $stdout.puts text
        end

usage(generator_names)

Show usage and exit

[Source]

    # File rdoc/options.rb, line 265
        def OptionList.usage(generator_names)

          puts
          puts(VERSION_STRING)
          puts

          name = File.basename($0)
          OptionList.strip_output("Usage:\n\n\#{name} [options]  [names...]\n\nFiles are parsed, and the information they contain\ncollected, before any output is produced. This allows cross\nreferences between all files to be resolved. If a name is a\ndirectory, it is traversed. If no names are specified, all\nRuby files in the current directory (and subdirectories) are\nprocessed.\n\nOptions:\n\n")

          OPTION_LIST.each do |long, short, arg, desc|
            opt = sprintf("%20s", "#{long}, #{short}")
            oparg = sprintf("%-7s", arg)
            print "#{opt} #{oparg}"
            desc = desc.split("\n")
            if arg.nil? || arg.length < 7
              puts desc.shift
            else
              puts
            end
            desc.each do |line|
              puts(" "*28 + line)
            end
            puts
          end

          puts "\nAvailable output formatters: " +
            generator_names.sort.join(', ') + "\n\n"

          puts "For information on where the output goes, use\n\n"
          puts "   rdoc --help-output\n\n"

          exit 0
        end

[Validate]