Subject: Re: Designing a Cabinet class
	Date: ven 28 giu 13 09:01:48 +0900

Quoting Mike Vezzani (lists / ruby-forum.com):

> When a user goes to remove an item from the drawer, they will be
> presented with a list of items in the drawer. This list will be
> populated by the drawer_contents array. Instead of asking them to type a
> number that would correspond to the the item's array index, I want them
> to simply type the item name and have it removed from the
> drawer_contents array. I feel like there should be an easy way to do
> this, but I am stumped.

To remove an item from an array, you have array#delete(object). But
what you are not doing is using instance variables. If you want
variables to survive as long as your object exists, you must prepend a
'@' to the variable name. And of course, you are missing the
initialization method (called 'initialize'), where instance variables
should be initialized at beginning.

You should go through some elementary-level Ruby tutorial to learn
about these things. If you look at the archive of this list, there
have been several threads where fine tutorials have been mentioned. A
good page to start from is this one, from within Ruby's home page:

http://www.ruby-lang.org/en/documentation/

Carlo

-- 
  *         Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido / fluido.as             che bisogno ci sarebbe
  *               di parlare tanto di amore e di rettitudine? (Chuang-Tzu)