Class: RailsDataPdf
- Inherits:
-
Prawn::Document
- Object
- Prawn::Document
- RailsDataPdf
- Defined in:
- app/pdfs/rails_data_pdf.rb
Instance Method Summary collapse
-
#empty? ⇒ Boolean
todo hack for a bug, need confirm ?.
-
#initialize ⇒ RailsDataPdf
constructor
A new instance of RailsDataPdf.
- #run ⇒ Object
Constructor Details
#initialize ⇒ RailsDataPdf
Returns a new instance of RailsDataPdf.
6 7 8 9 10 11 |
# File 'app/pdfs/rails_data_pdf.rb', line 6 def initialize default_config = { page_size: 'A4' } super(default_config) end |
Instance Method Details
#empty? ⇒ Boolean
todo hack for a bug, need confirm ?
28 29 30 |
# File 'app/pdfs/rails_data_pdf.rb', line 28 def empty? page.content.stream.length <= 2 end |
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/pdfs/rails_data_pdf.rb', line 13 def run return self unless self.empty? once_header beginning_data if beginning_data repeat_header header_data if header_data table_data.each_with_index do |value, index| start_new_page unless index == 0 custom_table value end ending_data if ending_data if self end |