Module: ActiveCart::Item
- Included in:
- ActiveCart::Items::MemoryItem
- Defined in:
- lib/active_cart/item.rb
Instance Method Summary collapse
-
#id ⇒ Object
A unique id for the item.
-
#name ⇒ Object
A display name for the item.
-
#price ⇒ Object
Returns the price of this item.
-
#quantity ⇒ Object
Returns the quantity of this item in the context of a cart.
-
#quantity=(quantity) ⇒ Object
Set the quantity of this item in the context of a cart.
Instance Method Details
#id ⇒ Object
A unique id for the item. The Mixee needs to implement this or a NotImplementedError will be thrown
8 9 10 |
# File 'lib/active_cart/item.rb', line 8 def id raise NotImplementedError end |
#name ⇒ Object
A display name for the item. The Mixee needs to implement this or a NotImplementedError will be thrown
14 15 16 |
# File 'lib/active_cart/item.rb', line 14 def name raise NotImplementedError end |
#price ⇒ Object
Returns the price of this item
32 33 34 |
# File 'lib/active_cart/item.rb', line 32 def price raise NotImplementedError end |
#quantity ⇒ Object
Returns the quantity of this item in the context of a cart
20 21 22 |
# File 'lib/active_cart/item.rb', line 20 def quantity @quantity || 0 end |
#quantity=(quantity) ⇒ Object
Set the quantity of this item in the context of a cart
26 27 28 |
# File 'lib/active_cart/item.rb', line 26 def quantity=(quantity) @quantity = quantity end |