Class: Tabledata::Presenters::PDF

Inherits:
Tabledata::Presenter show all
Defined in:
lib/tabledata/presenters/pdf.rb

Instance Attribute Summary

Attributes inherited from Tabledata::Presenter

#options, #table, #tables

Instance Method Summary collapse

Methods inherited from Tabledata::Presenter

add_presenter!, #initialize, #multiple_tables?, present, presenter_exists?, replace_presenter!, #single_table?

Constructor Details

This class inherits a constructor from Tabledata::Presenter

Instance Method Details

#documentObject


11
12
13
14
15
16
17
18
# File 'lib/tabledata/presenters/pdf.rb', line 11

def document
  pdf = Prawn::Document.new
  tables.each do |id, table|
    pdf.table table.data
  end

  pdf
end

#string(options = nil) ⇒ Object


20
21
22
# File 'lib/tabledata/presenters/pdf.rb', line 20

def string(options=nil)
  document.render
end

#write(path, options = nil) ⇒ Object


24
25
26
# File 'lib/tabledata/presenters/pdf.rb', line 24

def write(path, options=nil)
  document.render_file(path)
end