benchmarks/io/read.rb
## everything until the next comma (or end of line)
everything until the next comma (or end of line)
everything until the next comma ( or end of line )
def readline_scanner( input )
  recs = []
  buf  = StringScanner.new( "" )
  input.each_line do |line|
     buf.string = line.chomp    
     rec = []
     loop do
       value = buf.scan( NOT_COMMA_RX )
       rec << value   
       break if buf.eos?
       buf.getch  
     end
     recs << rec  
  end
  recs
end
def readline_scanner ( input ) recs = [ ] buf = StringScanner . new ( "" ) input . each_line do | line | buf . string = line . chomp rec = [ ] loop do value = buf . scan ( NOT_COMMA_RX ) rec << value break if buf . eos? buf . getch end recs << rec end recs end
everything until the next comma (or end of line)
everything until the next comma ( or end of line )
## was: StringScanner.new( line.chomp ) ## todo: check for value nil/no match - no more value found - why? why not? ## eat-up comma # add record
input