Class: Wizport::Builder::Pdf
- Inherits:
-
Object
- Object
- Wizport::Builder::Pdf
- Defined in:
- lib/wizport/builder/pdf.rb
Instance Method Summary collapse
- #footer ⇒ Object
- #grid ⇒ Object
- #header ⇒ Object
-
#initialize(report) ⇒ Pdf
constructor
A new instance of Pdf.
- #save(file) ⇒ Object
- #section(section) ⇒ Object
- #section_body(section, group) ⇒ Object
- #section_footer(section, group) ⇒ Object
- #section_header(section, group) ⇒ Object
Constructor Details
Instance Method Details
#footer ⇒ Object
55 56 57 |
# File 'lib/wizport/builder/pdf.rb', line 55 def end |
#grid ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/wizport/builder/pdf.rb', line 18 def grid tbl = [] tbl << @rpt.columns.map {|c| c.title } @rpt.source.all.each do |obj| tbl << @rpt.columns.map {|c| obj.send(c.name)} end @pdf.table tbl end |
#header ⇒ Object
14 15 16 |
# File 'lib/wizport/builder/pdf.rb', line 14 def header @pdf.text @rpt.title end |
#save(file) ⇒ Object
59 60 61 |
# File 'lib/wizport/builder/pdf.rb', line 59 def save(file) @pdf.save(file) end |
#section(section) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/wizport/builder/pdf.rb', line 27 def section(section) @tbl = [] @rpt.source.groups(section).each do |group| section_header(section,group) section_body(section,group) (section,group) end @pdf.table @tbl end |
#section_body(section, group) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/wizport/builder/pdf.rb', line 41 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 << [@pdf.make_table(rows)] end |
#section_footer(section, group) ⇒ Object
51 52 53 |
# File 'lib/wizport/builder/pdf.rb', line 51 def (section,group) end |
#section_header(section, group) ⇒ Object
37 38 39 |
# File 'lib/wizport/builder/pdf.rb', line 37 def section_header(section,group) @tbl << ["#{section.title}:#{group}"] end |