From: "S. Robert James" Date: 2007-02-22T10:40:11+09:00 Subject: Re: Parsing a file with look ahead Thanks! BTW, looking at the Rdoc, it seems each_cons is what I want, no? On Feb 21, 7:56 pm, "Florian Frank" wrote: > S. Robert James wrote: > > I'd like to: > > parse('Hi', 'How') > > parse('How', 'Are') > > parse('Are', 'you?') > > parse('you?', false) > > # hey, this is practically a unit test! > > > Any ideas? > > require 'enumerator' > > File.new(filename).enum_slice(2).each do |first, second| > p [ first, second ? second : false ] > end > > -- > Florian Frank