about summary refs log tree commit homepage
path: root/lib/yahns/tmpio.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/tmpio.rb')
-rw-r--r--lib/yahns/tmpio.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/yahns/tmpio.rb b/lib/yahns/tmpio.rb
index 4fe4794..bcf6b8a 100644
--- a/lib/yahns/tmpio.rb
+++ b/lib/yahns/tmpio.rb
@@ -11,10 +11,10 @@ class Yahns::TmpIO < File # :nodoc:
   # creates and returns a new File object.  The File is unlinked
   # immediately, switched to binary mode, and userspace output
   # buffering is disabled
-  def self.new
+  def self.new(tmpdir = Dir.tmpdir)
     retried = false
     begin
-      fp = super("#{Dir.tmpdir}/#{rand}", RDWR|CREAT|EXCL, 0600)
+      fp = super("#{tmpdir}/#{rand}", RDWR|CREAT|EXCL, 0600)
     rescue Errno::EEXIST
       retry
     rescue Errno::EMFILE, Errno::ENFILE