Class: Basket
- Inherits:
-
Object
- Object
- Basket
- Defined in:
- lib/basket.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #add(item) ⇒ Object
-
#initialize ⇒ Basket
constructor
A new instance of Basket.
Constructor Details
#initialize ⇒ Basket
Returns a new instance of Basket.
3 4 5 |
# File 'lib/basket.rb', line 3 def initialize @items = [] end |
Instance Attribute Details
#items ⇒ Object (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
6 7 8 |
# File 'lib/basket.rb', line 6 def add item @items << item end |