Class: QueryReport::ReportPdf

Inherits:
Object
  • Object
show all
Defined in:
lib/query_report/report_pdf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ ReportPdf

Returns a new instance of ReportPdf.



5
6
7
8
9
# File 'lib/query_report/report_pdf.rb', line 5

def initialize(report)
  @report = report
  @options = QueryReport.config.pdf_options
  @pdf = Prawn::Document.new
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/query_report/report_pdf.rb', line 3

def options
  @options
end

#pdfObject (readonly)

Returns the value of attribute pdf.



3
4
5
# File 'lib/query_report/report_pdf.rb', line 3

def pdf
  @pdf
end

#reportObject (readonly)

Returns the value of attribute report.



3
4
5
# File 'lib/query_report/report_pdf.rb', line 3

def report
  @report
end

Instance Method Details



16
17
18
# File 'lib/query_report/report_pdf.rb', line 16

def render_footer
  template.try(:render_footer)
end

#render_headerObject

render the header from the template class



12
13
14
# File 'lib/query_report/report_pdf.rb', line 12

def render_header
  template.try(:render_header)
end

#to_pdfObject



20
21
22
23
24
# File 'lib/query_report/report_pdf.rb', line 20

def to_pdf
  render_charts_with report
  render_table_with report
  pdf
end