From: "Ara.T.Howard" Date: 2004-06-20T01:33:18+09:00 Subject: Re: [RCR] IO#readn On Sun, 20 Jun 2004, Michael Neumann wrote: > Hi, > > I suggest to add a method readn to the IO class (and to StringIO, > Socket...), which behaves similar to read(n), but raises an exception if > the returned string is not of size n. > > class IO > def readn(n) > str = read(n) > raise if str.nil? or str.size != n > str > end > end > > It's annoying to test for it in the application. > > Regards, > > Michael don't you think the code will be just as long/annoying with a begin/rescue block? -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; and a weed grows, even though we do | not love it. --Dogen ===============================================================================