StdlibDoc::GenDoc::Target (Class)

In: StdlibDoc/GenDoc/Database.rb
Parent: Object

Represents a documentation target. See the database YAML file for a description of the fields.

For example, the ‘cgi’ target specified all the CGI-related files to become arguments to RDoc (that would be ‘cgi.rb’ and ‘cgi/’, as RDoc will descend directories). Since it has multiple files, it might specify a main page.

Methods

new  

Attributes

base  [R]  Hmmm… let me think about this one.
config  [R] 
description  [R]  A description of this Ruby package.
mainpage  [R]  ‘main’ argument to RDoc. May be nil.
section  [R]  The ‘section’ it is in. Only ‘stdlib’ makes sense at the moment. In future we may document ‘core’ files as well, like array.c.
sources  [R]  Array of source files, relative to ‘base’, that are to be included in RDoc command.
target  [R]  The name of the target. TODO: change to ‘name’ ?

Public Class methods

A Target object is constructed from a hash containing the relevant keys and data.

[Source]

# File StdlibDoc/GenDoc/Database.rb, line 58
    def initialize(config, hash)
      @config = config
      @target, @section, @base = hash.values_at('target', 'section', 'base')
      @sources, @mainpage, @description =
        hash.values_at('sources', 'mainpage', 'description')
      # Massage the sources into an array, and provide default value if necessary.

      if @sources
        @sources = @sources.split
      else
        # XXX: next line assumes rb extension; doesn't hold for core files like

        # array.c

        @sources = ["#{@target}.rb"]
      end
      # Default value for base.

      if @base.nil?
        if @section == 'stdlib'
          @base = @config.ruby_base + "lib"
        end
      end
      # Work around some YAML funnies.

      if @description and not @description.empty?
        @description = @description.join(" ") if @description.is_a? Array
        @description = @description.gsub(/\n+/, " ").strip
      end
      _sanity_check
    end

[Validate]