Class: Payday::LineItem
- Inherits:
-
Object
- Object
- Payday::LineItem
- Includes:
- LineItemable
- Defined in:
- lib/payday/line_item.rb
Overview
Represents a line item in an invoice.
quantity
and price
are written to be pretty picky, primarily because if we’re not picky about what values are set to them your invoice math could get pretty messed up. It’s recommended that both values be set to BigDecimal
values. Otherwise, we’ll do our best to convert the set values to a BigDecimal
.
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#display_price ⇒ Object
Returns the value of attribute display_price.
-
#display_quantity ⇒ Object
Returns the value of attribute display_quantity.
-
#price ⇒ Object
Returns the value of attribute price.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ LineItem
constructor
Initializes a new LineItem.
Methods included from LineItemable
Constructor Details
#initialize(options = {}) ⇒ LineItem
Initializes a new LineItem
13 14 15 16 17 18 19 |
# File 'lib/payday/line_item.rb', line 13 def initialize( = {}) self.quantity = [:quantity] || "1" self.display_quantity = [:display_quantity] self.display_price = [:display_price] self.price = [:price] || "0.00" self.description = [:description] || "" end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
10 11 12 |
# File 'lib/payday/line_item.rb', line 10 def description @description end |
#display_price ⇒ Object
Returns the value of attribute display_price.
10 11 12 |
# File 'lib/payday/line_item.rb', line 10 def display_price @display_price end |
#display_quantity ⇒ Object
Returns the value of attribute display_quantity.
10 11 12 |
# File 'lib/payday/line_item.rb', line 10 def display_quantity @display_quantity end |
#price ⇒ Object
Returns the value of attribute price.
10 11 12 |
# File 'lib/payday/line_item.rb', line 10 def price @price end |
#quantity ⇒ Object
Returns the value of attribute quantity.
10 11 12 |
# File 'lib/payday/line_item.rb', line 10 def quantity @quantity end |