Description
The file-temp library is an alternate way to handle tempfile generation.
Synopsis
require 'file/temp'
fh = FileTemp.new
fh.puts "hello"
fh.close
fh = FileTemp.new(false)
fh.puts "world"
fh.close
Installation
Standard Installation
rake test (optional)
rake install
Gem Installation
rake test (optional)
rake gem_install
Motivation
Ruby's tempfile.rb is overwrought and susceptible to race conditions. This
This library uses your system's native tmpfile() or mkstemp() functions
instead of trying to handle race conditions manually via pure Ruby.
Other libraries
I am aware of Cian Synnott's ruby-stemp project. However, I don't like the
interface, it's GNU-centric (which causes portability issues), and Cian
has disabled all the trackers and mailing lists on the RubyForge project
site, as well as online SCM access. So, if he doesn't want feedback, I'm
not going to waste time with it.
Future Plans
I plan on adding a pure Ruby version for MS Windows eventually.
License
Ruby's
Copyright
(C) 2007 Daniel J. Berger
All Rights Reserved
Warranty
This package is provided "as is" and without any express or
implied warranties, including, without limitation, the implied
warranties of merchantability and fitness for a particular purpose.
Author
Daniel J. Berger
djberg96 at gmail dot com
See also
tmpfile(), mkstemp(), tmpnam()