From: Tom Sawyer Date: 2002-07-07T15:24:57+09:00 Subject: Re: Pre-RCR... nil.empty? i've done that too. in fact i've added a number of things to the NilClass: class NilClass def [](arg) return nil end def empty? true end def to_b false end def to_f 0.0 end alias size to_i alias length to_i end ~transami On Sat, 2002-07-06 at 21:09, Dave Thomas wrote: > > > Working with CGI forms and databases, it's something of a pain having > to do > > string = cgi['field'][0] > > if string.nil? || string.empty? > error "Please specify a value for 'field'" > end > > etc etc... > > Would it be silly to have a predefined method: > > def nil.empty? > true > end > > > Cheers > > > Dave > -- ~transami "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -- Benjamin Franklin