Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • rdoc/options.rb

Files

Class/Module Index [+]

Quicksearch

Options::OptionList

Constants

OPTION_LIST

Public Class Methods

error(msg) click to toggle source

Show an error and exit

 
               # File rdoc/options.rb, line 263
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() click to toggle source
 
               # File rdoc/options.rb, line 320
    def OptionList.help_output
      OptionList.strip_output("      How RDoc generates output depends on the output formatter being
      used, and on the options you give.

      - HTML output is normally produced into a number of separate files
        (one per class, module, and file, along with various indices). 
        These files will appear in the directory given by the --op
        option (doc/ by default).

      - XML output by default is written to standard output. If a
        --opname option is given, the output will instead be written
        to a file with that name in the output directory.

      - .chm files (Windows help files) are written in the --op directory.
        If an --opname parameter is present, that name is used, otherwise
        the file will be called rdoc.chm.

      For information on other RDoc options, use "rdoc --help".
")
      exit 0
    end
            
options() click to toggle source
 
               # File rdoc/options.rb, line 243
def OptionList.options
  OPTION_LIST.map do |long, short, arg,|
    [ long, 
      short, 
      arg ? GetoptLong::REQUIRED_ARGUMENT : GetoptLong::NO_ARGUMENT 
    ]
  end
end
            
strip_output(text) click to toggle source
 
               # File rdoc/options.rb, line 253
def OptionList.strip_output(text)
  text =~ /^\s+/
  leading_spaces = $&
  text.gsub!(/^#{leading_spaces}/, '')
  $stdout.puts text
end
            
usage(generator_names) click to toggle source

Show usage and exit

 
               # File rdoc/options.rb, line 272
    def OptionList.usage(generator_names)
      
      puts
      puts(VERSION_STRING)
      puts

      name = File.basename($0)
      OptionList.strip_output("          Usage:

            #{name} [options]  [names...]

          Files are parsed, and the information they contain
          collected, before any output is produced. This allows cross
          references between all files to be resolved. If a name is a
          directory, it is traversed. If no names are specified, all
          Ruby files in the current directory (and subdirectories) are
          processed.

          Options:

")

      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
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus