[#2367] Standard libraries — Dave Thomas <dave@...>

From ruby-dev summary:

60 messages 2004/02/11

[#2397] PATCH: deprecate cgi-lib, getopts, importenv, parsearg from standard library — Gavin Sinclair <gsinclair@...>

Index: cgi-lib.rb

15 messages 2004/02/12

[#2465] PATCH: OpenStruct#initialize to yield self — Gavin Sinclair <gsinclair@...>

This is a common approach I use to object initialization; I don't know

24 messages 2004/02/19

Re: Standard libraries

From: "NAKAMURA, Hiroshi" <nahi@...>
Date: 2004-02-13 06:00:22 UTC
List: ruby-core #2428
Hi,

> From: "Dave Thomas" <dave@thomases.com>
> Sent: Friday, February 13, 2004 2:10 PM

> >   class Row < Array
> >     # SYNOPSIS
> >     #   CSV::Row#to_a
> >     #
> >     # RETURNS
> >     #   An Array of String.
> >     #
> >     # DESCRIPTION
> >     #   Convert CSV::Cell to String.  Null is converted to nil.
> >     #
> >     def to_a
> >       self.collect { |cell| cell.is_null ? nil : cell.data }
> >     end

Sorry, I found wrong DESCRIPTION.  Convert to string?
It returns an Array of cell.data.  Source means everything.

> I don't think all of it is. I might document it as
> 
>     # Return this row as an Array containing Strings or +nil+
>     def to_a
>       ...
>     end

I relieved to hear that.  Thanks.  Though I still think
  "self.collect { |cell| cell.is_null ? nil : cell.data }"
could be enough for a programmer who read it...

Regards,
// NaHi

In This Thread