On Tue, Feb 25, 2003 at 08:01:43PM +0900, NAKAMURA, Hiroshi wrote:
> > class String
> >   def csv_to_a
> >     CSV.parse_line(self)
> >   end
> > end
> > 
> > class Array
> >   def to_csv
> >     CSV.generate_line(self)
> >   end
> > end
> 
> parse_line and generate_line are methods of CSV2.
> CSV2 has not yet been released.

That looks like it will be much nicer, thank you.

What happens if the line being parsed is incomplete because it contains a
quoted newline? Perhaps it could take a block to fetch any additional lines
needed, e.g.

  while line = gets
    data = CSV.parse_line(line) { gets }
  end

In that case it would probably be better to use a block in the first place,
i.e.

  while data = CSV.parser { gets }
    # 'data' is an array containing the cells for one logical row
  end

The simpler the API the better :-)

Regards,

Brian.