Class: Invoicer

Inherits:
Prawn::Document
  • Object
show all
Defined in:
lib/invoicer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Invoicer

Returns a new instance of Invoicer.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/invoicer.rb', line 7

def initialize(options={})
  # Array of hashes:
  # @entries << {:description => '', :rate => 0, :number => 0}
  @entries  = options.delete(:entries) || []
  @company  = options.delete(:company)
  @customer = options.delete(:customer)
  @notes    = options.delete(:notes)
  @foot     = options.delete(:footer)
  @number   = options.delete(:number)

  super
end

Instance Attribute Details

#companyObject

Returns the value of attribute company.



5
6
7
# File 'lib/invoicer.rb', line 5

def company
  @company
end

#customerObject

Returns the value of attribute customer.



5
6
7
# File 'lib/invoicer.rb', line 5

def customer
  @customer
end

#entriesObject

Returns the value of attribute entries.



5
6
7
# File 'lib/invoicer.rb', line 5

def entries
  @entries
end

#footObject

Returns the value of attribute foot.



5
6
7
# File 'lib/invoicer.rb', line 5

def foot
  @foot
end

#notesObject

Returns the value of attribute notes.



5
6
7
# File 'lib/invoicer.rb', line 5

def notes
  @notes
end

Instance Method Details

#draw_invoiceObject



20
21
22
23
24
25
26
27
# File 'lib/invoicer.rb', line 20

def draw_invoice
  draw_header
  draw_addresses
  draw_entries
  draw_vat_and_total
  draw_notes
  draw_foot
end