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.
rubocop:todo Layout/LineLength quantity
and price
are written to be pretty picky, primarily because if we’re not picky about what values are set to rubocop:enable Layout/LineLength 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.
-
#predefined_amount ⇒ Object
Returns the value of attribute predefined_amount.
-
#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
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/payday/line_item.rb', line 20 def initialize( = {}) if [:predefined_amount] self.predefined_amount = [:predefined_amount] else self.quantity = [:quantity] || '1' self.display_quantity = [:display_quantity] self.display_price = [:display_price] self.price = [:price] || '0.00' end self.description = [:description] || '' end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
16 17 18 |
# File 'lib/payday/line_item.rb', line 16 def description @description end |
#display_price ⇒ Object
Returns the value of attribute display_price.
16 17 18 |
# File 'lib/payday/line_item.rb', line 16 def display_price @display_price end |
#display_quantity ⇒ Object
Returns the value of attribute display_quantity.
16 17 18 |
# File 'lib/payday/line_item.rb', line 16 def display_quantity @display_quantity end |
#predefined_amount ⇒ Object
Returns the value of attribute predefined_amount.
17 18 19 |
# File 'lib/payday/line_item.rb', line 17 def predefined_amount @predefined_amount end |
#price ⇒ Object
Returns the value of attribute price.
17 18 19 |
# File 'lib/payday/line_item.rb', line 17 def price @price end |
#quantity ⇒ Object
Returns the value of attribute quantity.
17 18 19 |
# File 'lib/payday/line_item.rb', line 17 def quantity @quantity end |