Class: Basket

Inherits:
Object
  • Object
show all
Defined in:
lib/basket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBasket

Returns a new instance of Basket.



4
5
6
# File 'lib/basket.rb', line 4

def initialize
  @items = Array.new
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



2
3
4
# File 'lib/basket.rb', line 2

def items
  @items
end

Instance Method Details

#add(item) ⇒ Object



8
9
10
# File 'lib/basket.rb', line 8

def add item
  @items << item
end