Parent

ReportBuilder::Section

Creates a Section. A section have a name and contains other elements. Sections could be nested inside anothers

Attributes

parent[R]
elements[R]
name[R]

Public Class Methods

new(options=Hash.new, &block) click to toggle source
    # File lib/reportbuilder/section.rb, line 8
 8:   def initialize(options=Hash.new, &block)
 9:     if !options.has_key? :name
10:       @name="Section #{@@n}"
11:       @@n+=1
12:     else
13:       @name=options[:name]
14:     end
15:     @parent = nil
16:     @elements = []
17:     if block
18:       add(block)
19:     end
20:   end

Public Instance Methods

add(element) click to toggle source
    # File lib/reportbuilder/section.rb, line 46
46:   def add(element)
47:     if element.is_a? ReportBuilder::Section
48:       element.parent=self
49:     end
50:     @elements.push(element)
51:   end
parent=(sect) click to toggle source
    # File lib/reportbuilder/section.rb, line 21
21:   def parent=(sect)
22:     if sect.is_a? ReportBuilder::Section
23:       @parent=sect
24:     else
25:       raise ArgumentError("Parent should be a Section")
26:     end
27:   end
report_building_html(g) click to toggle source
    # File lib/reportbuilder/section.rb, line 34
34:   def report_building_html(g)
35:     htag="h#{g.parse_level+1}"
36:     anchor=g.toc_entry(name)
37:     g.html "<div class='section'><#{htag}>#{name}</#{htag}><a name='#{anchor}'></a>"
38:     g.parse_cycle(self)
39:     g.html "</div>"
40:   end
report_building_rtf(g) click to toggle source
    # File lib/reportbuilder/section.rb, line 41
41:   def report_building_rtf(g)
42:     level=g.parse_level
43:     g.header(level,name)
44:     g.parse_cycle(self)
45:   end
report_building_text(builder) click to toggle source
    # File lib/reportbuilder/section.rb, line 29
29:   def report_building_text(builder)
30:     builder.text(("="*builder.parse_level)+" "+name)
31:     builder.parse_cycle(self)
32:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.