Class: ActiveCart::Items::MemoryItem

Inherits:
Object
  • Object
show all
Includes:
ActiveCart::Item
Defined in:
lib/active_cart/items/memory_item.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from ActiveCart::Item

#quantity, #quantity=

Constructor Details

- (MemoryItem) initialize(id, name, price)

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

- (Object) id

Returns the value of attribute id



4
5
6
# File 'lib/active_cart/items/memory_item.rb', line 4

def id
  @id
end

- (Object) name

Returns the value of attribute name



4
5
6
# File 'lib/active_cart/items/memory_item.rb', line 4

def name
  @name
end

- (Object) price

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

- (Object) ==(item)



7
8
9
# File 'lib/active_cart/items/memory_item.rb', line 7

def ==(item)
  self.id == item.id
end