Class: Receipts::Receipt
- Inherits:
-
Prawn::Document
- Object
- Prawn::Document
- Receipts::Receipt
- Defined in:
- lib/receipts/receipt.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#custom_font ⇒ Object
readonly
Returns the value of attribute custom_font.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
-
#logo ⇒ Object
readonly
Returns the value of attribute logo.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#product ⇒ Object
readonly
Returns the value of attribute product.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Receipt
constructor
A new instance of Receipt.
Constructor Details
#initialize(attributes) ⇒ Receipt
Returns a new instance of Receipt.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/receipts/receipt.rb', line 5 def initialize(attributes) @attributes = attributes @id = attributes.fetch(:id) @company = attributes.fetch(:company) @line_items = attributes.fetch(:line_items) @custom_font = attributes.fetch(:font, {}) @message = attributes.fetch(:message) { } super(margin: 0) setup_fonts if custom_font.any? generate end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/receipts/receipt.rb', line 3 def attributes @attributes end |
#company ⇒ Object (readonly)
Returns the value of attribute company.
3 4 5 |
# File 'lib/receipts/receipt.rb', line 3 def company @company end |
#custom_font ⇒ Object (readonly)
Returns the value of attribute custom_font.
3 4 5 |
# File 'lib/receipts/receipt.rb', line 3 def custom_font @custom_font end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/receipts/receipt.rb', line 3 def id @id end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
3 4 5 |
# File 'lib/receipts/receipt.rb', line 3 def line_items @line_items end |
#logo ⇒ Object (readonly)
Returns the value of attribute logo.
3 4 5 |
# File 'lib/receipts/receipt.rb', line 3 def logo @logo end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/receipts/receipt.rb', line 3 def @message end |
#product ⇒ Object (readonly)
Returns the value of attribute product.
3 4 5 |
# File 'lib/receipts/receipt.rb', line 3 def product @product end |