Thank you all, I understood the idea of a temporary file and I think 
this will solve my problem.

-- 
Posted via http://www.ruby-forum.com/.