Class: PdfInvoice::Invoice
- Inherits:
-
Object
- Object
- PdfInvoice::Invoice
- Defined in:
- lib/pdfinvoice/invoice.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#debitor_address ⇒ Object
Returns the value of attribute debitor_address.
-
#description ⇒ Object
Returns the value of attribute description.
-
#invoice_number ⇒ Object
Returns the value of attribute invoice_number.
-
#items ⇒ Object
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(config) ⇒ Invoice
constructor
A new instance of Invoice.
- #to_pdf ⇒ Object
Constructor Details
#initialize(config) ⇒ Invoice
Returns a new instance of Invoice.
16 17 18 19 20 |
# File 'lib/pdfinvoice/invoice.rb', line 16 def initialize(config) @config = config @date = Date.today @items = [] end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
15 16 17 |
# File 'lib/pdfinvoice/invoice.rb', line 15 def date @date end |
#debitor_address ⇒ Object
Returns the value of attribute debitor_address.
15 16 17 |
# File 'lib/pdfinvoice/invoice.rb', line 15 def debitor_address @debitor_address end |
#description ⇒ Object
Returns the value of attribute description.
15 16 17 |
# File 'lib/pdfinvoice/invoice.rb', line 15 def description @description end |
#invoice_number ⇒ Object
Returns the value of attribute invoice_number.
15 16 17 |
# File 'lib/pdfinvoice/invoice.rb', line 15 def invoice_number @invoice_number end |
#items ⇒ Object
Returns the value of attribute items.
15 16 17 |
# File 'lib/pdfinvoice/invoice.rb', line 15 def items @items end |
Instance Method Details
#to_pdf ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pdfinvoice/invoice.rb', line 21 def to_pdf pdf = PDF::Writer.new pdf.margins_pt(pdf.mm2pts(15), pdf.mm2pts(25), pdf.mm2pts(15), pdf.mm2pts(15)) pdf.select_font(@config.font) pdf_header(pdf) pdf_items(pdf) (pdf) pdf.render end |