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
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