Daniel Finnie wrote:
> Hi,
> 
> @installedPackageList is an IO object, not an array.  You need to read
> its contents, convert it into an array, and then remove things
> (readlines does steps one and two at once):
> @InstalledPackageList = @InstalledPackageList.readlines[5..-1]
> daniel@daniel-desktop:~/lightconsolegem$ ri IO#readlines
> ----------------------------------------------------------- IO#readlines
>      ios.readlines(sep_string=$/)  =>   array
> ------------------------------------------------------------------------
>      Reads all of the lines in ios, and returns them in anArray. Lines
>      are separated by the optional sep_string. If sep_string is nil,
>      the rest of the stream is returned as a single record. The stream
>      must be opened for reading or an IOError will be raised.
> 
>         f = File.new("testfile")
>         f.readlines[0]   #=> "This is line one\n"
> 
> 
> Dan

Hi all,
and thanks for your fast reply!

Sorry for the typo in the class name (before doing the post, I quickly 
rewrote the code to make it more sane/readable).

@Dan: that was the solution to my problem!

I'm just a little bit confused. I thought that I declared 
installedPackageList as an array in the constructor, and therefore 
expected it to be used like an array.

Is that a typical pitfall to ruby newbies? I think I'll have to use 
reflection alot more.

Cheers
Joey
-- 
Posted via http://www.ruby-forum.com/.