Class: Receipts::Statement
- Inherits:
-
Prawn::Document
- Object
- Prawn::Document
- Receipts::Statement
- Defined in:
- lib/receipts/statement.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#bill_to ⇒ Object
readonly
Returns the value of attribute bill_to.
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#custom_font ⇒ Object
readonly
Returns the value of attribute custom_font.
-
#end_date ⇒ Object
readonly
Returns the value of attribute end_date.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#issue_date ⇒ Object
readonly
Returns the value of attribute issue_date.
-
#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.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
-
#subheading ⇒ Object
readonly
Returns the value of attribute subheading.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Statement
constructor
A new instance of Statement.
Constructor Details
#initialize(attributes) ⇒ Statement
Returns a new instance of Statement.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/receipts/statement.rb', line 8 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) { } @subheading = attributes.fetch(:subheading) { default_subheading } @bill_to = Array(attributes.fetch(:bill_to)).join("\n") @issue_date = attributes.fetch(:issue_date) @start_date = attributes.fetch(:start_date) @end_date = attributes.fetch(:end_date) super(margin: 0) setup_fonts if custom_font.any? generate end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def attributes @attributes end |
#bill_to ⇒ Object (readonly)
Returns the value of attribute bill_to.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def bill_to @bill_to end |
#company ⇒ Object (readonly)
Returns the value of attribute company.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def company @company end |
#custom_font ⇒ Object (readonly)
Returns the value of attribute custom_font.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def custom_font @custom_font end |
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def end_date @end_date end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def id @id end |
#issue_date ⇒ Object (readonly)
Returns the value of attribute issue_date.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def issue_date @issue_date end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def line_items @line_items end |
#logo ⇒ Object (readonly)
Returns the value of attribute logo.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def logo @logo end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def @message end |
#product ⇒ Object (readonly)
Returns the value of attribute product.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def product @product end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def start_date @start_date end |
#subheading ⇒ Object (readonly)
Returns the value of attribute subheading.
6 7 8 |
# File 'lib/receipts/statement.rb', line 6 def subheading @subheading end |