Class: InvoiceCreator::Presenters::Invoice
- Inherits:
-
Object
- Object
- InvoiceCreator::Presenters::Invoice
- Extended by:
- Forwardable
- Defined in:
- lib/invoice_creator/presenters/invoice.rb
Instance Method Summary collapse
- #billable_amount ⇒ Object
- #date ⇒ Object
- #due_date ⇒ Object
- #expenses_amount ⇒ Object
- #filename ⇒ Object
- #has_expenses? ⇒ Boolean
-
#initialize(invoice:, config:) ⇒ Invoice
constructor
A new instance of Invoice.
- #invoice_identifier ⇒ Object
- #rate ⇒ Object
- #total ⇒ Object
Constructor Details
permalink #initialize(invoice:, config:) ⇒ Invoice
Returns a new instance of Invoice.
8 9 10 11 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 8 def initialize(invoice:, config:) @invoice = invoice @config = config end |
Instance Method Details
permalink #billable_amount ⇒ Object
[View source]
25 26 27 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 25 def billable_amount amount(@invoice.billable_amount) end |
permalink #date ⇒ Object
[View source]
21 22 23 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 21 def date @invoice.invoice_date.strftime(@config.date_format) end |
permalink #due_date ⇒ Object
[View source]
17 18 19 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 17 def due_date @invoice.due_date.strftime(@config.date_format) end |
permalink #expenses_amount ⇒ Object
[View source]
37 38 39 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 37 def expenses_amount amount(@invoice.expenses_amount) end |
permalink #filename ⇒ Object
[View source]
13 14 15 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 13 def filename @invoice.invoice_date.strftime(@config.filename) end |
permalink #has_expenses? ⇒ Boolean
41 42 43 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 41 def has_expenses? @invoice.expenses_amount > 0 end |
permalink #invoice_identifier ⇒ Object
[View source]
33 34 35 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 33 def invoice_identifier sprintf(@config.invoice_identifier, @invoice.number) end |
permalink #rate ⇒ Object
[View source]
29 30 31 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 29 def rate amount(@invoice.rate) end |
permalink #total ⇒ Object
[View source]
45 46 47 |
# File 'lib/invoice_creator/presenters/invoice.rb', line 45 def total amount(@invoice.total) end |