Class: ActiveCart::Items::MemoryItem
- Inherits:
-
Object
- Object
- ActiveCart::Items::MemoryItem
- Includes:
- ActiveCart::Item
- Defined in:
- lib/active_cart/items/memory_item.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#price ⇒ Object
Returns the value of attribute price.
Instance Method Summary collapse
- #==(item) ⇒ Object
-
#initialize(id, name, price) ⇒ MemoryItem
constructor
A new instance of MemoryItem.
Methods included from ActiveCart::Item
Constructor Details
#initialize(id, name, price) ⇒ MemoryItem
Returns a new instance of MemoryItem.
11 12 13 14 15 |
# File 'lib/active_cart/items/memory_item.rb', line 11 def initialize(id, name, price) @id = id @name = name @price = price end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/active_cart/items/memory_item.rb', line 4 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/active_cart/items/memory_item.rb', line 4 def name @name end |
#price ⇒ Object
Returns the value of attribute price.
4 5 6 |
# File 'lib/active_cart/items/memory_item.rb', line 4 def price @price end |
Instance Method Details
#==(item) ⇒ Object
7 8 9 |
# File 'lib/active_cart/items/memory_item.rb', line 7 def ==(item) self.id == item.id end |