Class: SqlReporter::Reporters::PdfReporter
- Defined in:
- lib/sql_reporter/reporters/pdf_reporter.rb
Constant Summary collapse
- EXTENSION =
'.pdf'
Instance Attribute Summary collapse
-
#plot_report ⇒ Object
readonly
Returns the value of attribute plot_report.
-
#table_report ⇒ Object
readonly
Returns the value of attribute table_report.
Attributes inherited from Reporter
#disable_console, #feature, #fname0, #fname1, #io, #master, #master_max_count, #output
Instance Method Summary collapse
- #after_generate_report ⇒ Object
-
#initialize(parser_hsh) ⇒ PdfReporter
constructor
A new instance of PdfReporter.
Methods inherited from Reporter
#generate_report, #output_file
Constructor Details
#initialize(parser_hsh) ⇒ PdfReporter
Returns a new instance of PdfReporter.
10 11 12 13 14 |
# File 'lib/sql_reporter/reporters/pdf_reporter.rb', line 10 def initialize(parser_hsh) super(parser_hsh) @table_report = SqlReporter::Reporters::PdfTableReporter.new(parser_hsh) @plot_report = SqlReporter::Reporters::PlotReporter.new(parser_hsh) end |
Instance Attribute Details
#plot_report ⇒ Object (readonly)
Returns the value of attribute plot_report.
8 9 10 |
# File 'lib/sql_reporter/reporters/pdf_reporter.rb', line 8 def plot_report @plot_report end |
#table_report ⇒ Object (readonly)
Returns the value of attribute table_report.
8 9 10 |
# File 'lib/sql_reporter/reporters/pdf_reporter.rb', line 8 def table_report @table_report end |
Instance Method Details
#after_generate_report ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sql_reporter/reporters/pdf_reporter.rb', line 16 def after_generate_report table_report.generate_report plot_report.generate_report Prawn::Document.generate(output_file) do |pdf| pdf.font_size(20) { pdf.text "Comparison report of #{@fname0} -> #{@fname1}", align: :center, styles: [:bold] } pdf.move_down 20 pdf.text 'Count changes:' pdf.move_down 10 pdf.image @plot_report.output_file, position: :center, scale: 0.8 pdf.move_down 10 pdf.text 'Timing changes:' pdf.move_down 10 pdf.image('time_' + @plot_report.output_file, position: :center, scale: 0.8) pdf.start_new_page pdf.font_size(25) { pdf.text 'Summary', align: :center, styles: [:bold] } pdf.move_down 10 table_report.produce_table(pdf) end end |