From: "Carlo E. Prelz" Date: 2013-01-02T15:47:39+09:00 Subject: Re: Keep temporary files Subject: Keep temporary files Date: Wed 02 Jan 13 07:14:18AM +0900 Quoting J??r??me R. (lists@ruby-forum.com): > In a project I am working on, Tempfile objects are used. Fine, but I > would like to add an option "keep temp file", in order to facilitate > debug in case of error. > > It seems that Tempfile object doesn't provide any way to do that. Would > you think it could a possible enhancement? I think it may be an enhancement for your program, not for Tempfile: the reson for existence of that class is to make sure the files it handle will be deleted as soon as they get closed. If you want to keep your files, designate a directory for them (I generally create a directory under /usr/share) and give to them names that include the time and date (to make sure there are no risk of duplicate names). Something like: FILE_PATH='/usr/share/myproject/' def file_name FILE_PATH+'file.'+Time::now.strftime('%y%m%d.%H%M%S') end You then may want to write a cleanup script that makes sure files older than a few weeks/months are deleted. Carlo -- * Se la Strada e la sua Virtu' non fossero state messe da parte, * K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)