Class Help, undifined local var or meth

R

Ryan Edwards-Crewe

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 = po_number
@notes = notes
@company = company
@unit_config = unit_config
@due_date = due_date
@quantity = quantity
end
def to_s
"#{po_number}\t#{notes}\t#{company}\t#{unit_config}\t#{due_date}\t#{quantity}\n"
end
end

class POList
def initialize
@purchase_orders = 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....

Crewe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top