Class: Spina::Shop::InvoicePresenter
- Inherits:
-
Object
- Object
- Spina::Shop::InvoicePresenter
- Defined in:
- app/presenters/spina/shop/invoice_presenter.rb
Instance Attribute Summary collapse
-
#invoice ⇒ Object
Returns the value of attribute invoice.
-
#view_context ⇒ Object
Returns the value of attribute view_context.
Instance Method Summary collapse
-
#initialize(invoice, view_context) ⇒ InvoicePresenter
constructor
A new instance of InvoicePresenter.
- #order_number ⇒ Object
- #payment_method ⇒ Object
- #sub_total ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(invoice, view_context) ⇒ InvoicePresenter
Returns a new instance of InvoicePresenter.
8 9 10 11 |
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 8 def initialize(invoice, view_context) @invoice = invoice @view_context = view_context end |
Instance Attribute Details
#invoice ⇒ Object
Returns the value of attribute invoice.
3 4 5 |
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 3 def invoice @invoice end |
#view_context ⇒ Object
Returns the value of attribute view_context.
3 4 5 |
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 3 def view_context @view_context end |
Instance Method Details
#order_number ⇒ Object
21 22 23 |
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 21 def order_number invoice.order.try(:number) end |
#payment_method ⇒ Object
25 26 27 |
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 25 def payment_method invoice.order.try(:payment_method) end |
#sub_total ⇒ Object
13 14 15 |
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 13 def sub_total view_context.number_to_currency(invoice.sub_total) end |
#total ⇒ Object
17 18 19 |
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 17 def total view_context.number_to_currency(invoice.total) end |