From: 7stud -- Date: 2008-03-10T06:34:59+09:00 Subject: Re: IO#Foreach -- Max line length Tristin Davis wrote: > That's what the 2nd if statement is; for catching the delimiter if the > buffer isn't too large. I can't use gets b/c I may expend all the > memory before the actual line is read. > Look. A string and a file are really no different--except reading from a file is slow. Therefore, to speed things up read in the maximum every time you read from the file, and store it in a string. Process the string just like you would the file. Then read from the file again. -- Posted via http://www.ruby-forum.com/.