Parent

Included Modules

RDoc::Context::Section

A per-comment section of documentation like:

  # :SECTION: The title
  # The body

Attributes

comment[R]

Section comment

parent[R]

Context this Section lives in

sequence[R]

Section sequence number (for linking)

title[R]

Section title

Public Class Methods

new(parent, title, comment) click to toggle source

Creates a new section with title and comment

     # File lib/rdoc/context.rb, line 115
115:     def initialize(parent, title, comment)
116:       @parent = parent
117:       @title = title
118: 
119:       @@sequence.succ!
120:       @sequence = @@sequence.dup
121: 
122:       set_comment comment
123:     end

Public Instance Methods

==(other) click to toggle source

Sections are equal when they have the same sequence

     # File lib/rdoc/context.rb, line 128
128:     def ==(other)
129:       self.class === other and @sequence == other.sequence
130:     end
set_comment(comment) click to toggle source

Set the comment for this section from the original comment block If the first line contains :section:, strip it and use the rest. Otherwise remove lines up to the line containing :section:, and look for those lines again at the end and remove them. This lets us write

  # blah blah blah
  #
  # :SECTION: The title
  # The body
     # File lib/rdoc/context.rb, line 150
150:     def set_comment(comment)
151:       return unless comment
152: 
153:       if comment =~ /^#[ \t]*:section:.*\n/ then
154:         start = $`
155:         rest = $'
156: 
157:         if start.empty?
158:           @comment = rest
159:         else
160:           @comment = rest.sub(/#{start.chomp}\Z/, '')
161:         end
162:       else
163:         @comment = comment
164:       end
165: 
166:       @comment = nil if @comment.empty?
167:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.