Hi all,
I receive an error stating that the method 'length' is not recognized. I am
using it at an array that exists within a class.
The error occurs at the line stating: nLength = @aObjects.length within the
method of addObject(object)
I think that it doesn't see @aObjects as an array, but I can't figure out why.
Any help?
Code:
class CLWindow
@strWindowName
@aObjects = Array.new
def setWindowName(windowname)
@strWindowName = windowname
end
def getWindowName()
return @strWindowName
end
def addObject(object)
nLength = @aObjects.length
@aObjects.insert(nLength, object)
end
def getObject(strName, strType, strFysDes)
i = 0;
if (strName!='') then
while
(aObjects[i].getObjectName()!=strName)and(i<=aObjects.length)
i=i+1
end
else
if (strType!='') then
while
(aObjects[i].getObjectType()!=strType)and(i<=aObjects.length)
i=i+1
end
else
if (strFysDes!='') then
while
(aObjects[i].getFysicalDescription()!=strFysDes)and(i<=aObjects.length)
i=i+1
end
else
return -1
end
end
end
if (i>aObjects.length) then
return -1
else
return aObjects[i]
end
end
end
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general