Class: Wizport::Builder::Rtf

Inherits:
Object
  • Object
show all
Defined in:
lib/wizport/builder/rtf.rb

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ Rtf

Returns a new instance of Rtf.



9
10
11
12
# File 'lib/wizport/builder/rtf.rb', line 9

def initialize(report)
  @rpt = report
  @rtf = Wizport::Rtf::Document.new
end

Instance Method Details



46
47
48
# File 'lib/wizport/builder/rtf.rb', line 46

def footer

end

#headerObject



14
15
16
# File 'lib/wizport/builder/rtf.rb', line 14

def header
  @rtf.text @rpt.title
end

#save(file) ⇒ Object



50
51
52
# File 'lib/wizport/builder/rtf.rb', line 50

def save(file)
  @rtf.save(file)
end

#section(section) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/wizport/builder/rtf.rb', line 18

def section(section)
  @tbl = []
  @rpt.source.groups(section).each do |group|
    section_header(section, group)
    section_body(section, group)
    (section, group)
  end
  @rtf.table @tbl
end

#section_body(section, group) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/wizport/builder/rtf.rb', line 32

def section_body(section, group)
  #rows = []
  #rows << @rpt.columns.map { |c| c.title }
  #objs = @rpt.source.filter({section.group => group})
  #objs.each do |obj|
  #  rows << @rpt.columns.map { |c| obj.send(c.name) }
  #end
  #@tbl << [@rtf.make_table(rows)]
end


42
43
44
# File 'lib/wizport/builder/rtf.rb', line 42

def (section, group)

end

#section_header(section, group) ⇒ Object



28
29
30
# File 'lib/wizport/builder/rtf.rb', line 28

def section_header(section, group)
  @tbl << ["#{section.title}:#{group}"]
end