> From: Daniel Sheppard [mailto:daniels / pronto.com.au] 
> [...]
> I find this the most readable way to do it, though using generator is
> probably slower than just keeping track of the last 3 lines as you go
> forward:
> 
> require 'generator'
> list = []
> File.open('toto.txt', 'rb') do |myFile|
> 	g = Generator.new(myFile)
> 	while g.next?
> 		if g.next =~ /regExp/
> 			3.times { list << g.next }
> 		end
> 	end
> end
> puts list

Well, yes. In the general case I would agree. 
In this case I think

list = []
File.open('toto.txt', 'rb') do |myFile|
  while line = myFile.gets do
    3.times {list << myFile.gets} if line =~ /regExp/
  end
end
puts list

is totally sufficient.

cheers

Simon