Module | RDoc

In:

rdoc/usage.rb
rdoc/rdoc.rb
rdoc/parsers/parse_simple.rb
rdoc/parsers/parse_rb.rb
rdoc/parsers/parse_f95.rb
rdoc/parsers/parse_c.rb
rdoc/parsers/parserfactory.rb
rdoc/generators/template/xml/xml.rb
rdoc/generators/template/xml/rdf.rb
rdoc/generators/template/html/one_page_html.rb
rdoc/generators/template/html/old_html.rb
rdoc/generators/template/html/kilmer.rb
rdoc/generators/template/html/html.rb
rdoc/generators/template/html/hefss.rb
rdoc/generators/template/chm/chm.rb
rdoc/diagram.rb
rdoc/code_objects.rb

# CSS2 RDoc HTML template

This is a template for RDoc that uses XHTML 1.0 Transitional and dictates a bit more of the appearance of the output to cascading stylesheets than the default. It was designed for clean inline code display, and uses DHTMl to toggle the visbility of each method’s source with each click on the ’[source]’ link.

## Authors

- Michael Granger <ged@FaerieMUD.org>

Copyright © 2002, 2003 The FaerieMUD Consortium. Some rights reserved.

This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit creativecommons.org/licenses/by/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

### Methods

usage usage_no_exit

### Classes and Modules

Module RDoc::Page
Module RDoc::ParserFactory
Class RDoc::Alias
Class RDoc::AnonClass
Class RDoc::AnyMethod
Class RDoc::Attr
Class RDoc::C_Parser
Class RDoc::ClassModule
Class RDoc::CodeObject
Class RDoc::Constant
Class RDoc::Context
Class RDoc::Diagram
Class RDoc::Fortran95parser
Class RDoc::Include
Class RDoc::NormalClass
Class RDoc::NormalModule
Class RDoc::RDoc
Class RDoc::RDocError
Class RDoc::Require
Class RDoc::RubyParser
Class RDoc::SimpleParser
Class RDoc::SingleClass
Class RDoc::Stats
Class RDoc::Token
Class RDoc::TopLevel

### Constants

DOT_DOC_FILENAME | = | ".document" |  | Name of the dotfile that contains the description of files to be processed in the current directory
GENERAL_MODIFIERS | = | [ 'nodoc' ].freeze
CLASS_MODIFIERS | = | GENERAL_MODIFIERS
ATTR_MODIFIERS | = | GENERAL_MODIFIERS
CONSTANT_MODIFIERS | = | GENERAL_MODIFIERS
METHOD_MODIFIERS | = | GENERAL_MODIFIERS + [ 'arg', 'args', 'yield', 'yields', 'notnew', 'not-new', 'not_new', 'doc' ]

KNOWN_CLASSES

=

{ "rb_cObject" => "Object", "rb_cArray" => "Array", "rb_cBignum" => "Bignum", "rb_cClass" => "Class", "rb_cDir" => "Dir", "rb_cData" => "Data", "rb_cFalseClass" => "FalseClass", "rb_cFile" => "File", "rb_cFixnum" => "Fixnum", "rb_cFloat" => "Float", "rb_cHash" => "Hash", "rb_cInteger" => "Integer", "rb_cIO" => "IO", "rb_cModule" => "Module", "rb_cNilClass" => "NilClass", "rb_cNumeric" => "Numeric", "rb_cProc" => "Proc", "rb_cRange" => "Range", "rb_cRegexp" => "Regexp", "rb_cString" => "String", "rb_cSymbol" => "Symbol", "rb_cThread" => "Thread", "rb_cTime" => "Time", "rb_cTrueClass" => "TrueClass", "rb_cStruct" => "Struct", "rb_eException" => "Exception", "rb_eStandardError" => "StandardError", "rb_eSystemExit" => "SystemExit", "rb_eInterrupt" => "Interrupt", "rb_eSignal" => "Signal", "rb_eFatal" => "Fatal", "rb_eArgError" => "ArgError", "rb_eEOFError" => "EOFError", "rb_eIndexError" => "IndexError", "rb_eRangeError" => "RangeError", "rb_eIOError" => "IOError", "rb_eRuntimeError" => "RuntimeError", "rb_eSecurityError" => "SecurityError", "rb_eSystemCallError" => "SystemCallError", "rb_eTypeError" => "TypeError", "rb_eZeroDivError" => "ZeroDivError", "rb_eNotImpError" => "NotImpError", "rb_eNoMemError" => "NoMemError", "rb_eFloatDomainError" => "FloatDomainError", "rb_eScriptError" => "ScriptError", "rb_eNameError" => "NameError", "rb_eSyntaxError" => "SyntaxError", "rb_eLoadError" => "LoadError", "rb_mKernel" => "Kernel", "rb_mComparable" => "Comparable", "rb_mEnumerable" => "Enumerable", "rb_mPrecision" => "Precision", "rb_mErrno" => "Errno", "rb_mFileTest" => "FileTest", "rb_mGC" => "GC", "rb_mMath" => "Math", "rb_mProcess" => "Process"

### Public Class methods

usage(*args)

Display usage information from the comment at the top of the file. String arguments identify specific sections of the comment to display. An optional integer first argument specifies the exit status (defaults to 0)

[Source]

    # File rdoc/usage.rb, line 81
      def RDoc.usage(*args)
        exit_code = 0

        if args.size > 0
          status = args[0]
          if status.respond_to?(:to_int)
            exit_code = status.to_int
            args.shift
          end
        end

        # display the usage and exit with the given code
        usage_no_exit(*args)
        exit(exit_code)
      end

usage_no_exit(*args)

Display usage

[Source]

    # File rdoc/usage.rb, line 98
      def RDoc.usage_no_exit(*args)
        main_program_file, = caller[-1].split(/:\d+/, 2)
        comment = File.open(main_program_file) do |file|
          find_comment(file)
        end

        comment = comment.gsub(/^\s*#/, '')

        markup = SM::SimpleMarkup.new
        flow_convertor = SM::ToFlow.new

        flow = markup.convert(comment, flow_convertor)

        format = "plain"

        unless args.empty?
          flow = extract_sections(flow, args)
        end

        options = RI::Options.instance
        if args = ENV["RI"]
          options.parse(args.split)
        end
        formatter = options.formatter.new(options, "")
        formatter.display_flow(flow)
      end

[Validate]