From: Robert Dober Date: 2006-07-13T01:40:16+09:00 Subject: Re: Class Help, undifined local var or meth ------=_Part_142341_1343756.1152722411598 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 7/12/06, Ryan Edwards-Crewe wrote: > > I was using this class before and it was fine until I tried to put it > into an array, and now I don't know what's wrong, I keep getting the > same > error, and I've check the spellings numerous times... > > class PurchaseOrder > def initialize(po_number, notes, company, unit_config, due_date, > quantity) > @po_number =3D po_number > @notes =3D notes > @company =3D company > @unit_config =3D unit_config > @due_date =3D due_date > @quantity =3D quantity > end > def to_s > > "#{po_number}\t#{notes}\t#{company}\t#{unit_config}\t#{due_date}\t#{q= uantity}\n" > end > end > > class POList > def initialize > @purchase_orders =3D Array.new > end > def append(anOrder) > @purchase_orders.push(anOrder) > self > end > def length > return @purchase_orders.length > end > def [](key) > if key.kind_of?(Integer) > @purchase_orders[key] > else > # ... > end > end > end > > This this line is where I get the error: > > aPOlist.append(PurchaseOrder.new("#{po_number}", "#{notes}", > "#{company}", "#{unit_config}", "#{due_date}", "#{quantity.to_i}")) > > any ideas.... It might be helpful to indicate the error message you have got. It will equally be useful to see where you created aPOlist which I suspect not to exist. Cheers Robert Crewe > > -- > Posted via http://www.ruby-forum.com/. > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_142341_1343756.1152722411598--