summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-11 10:17:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-11 10:17:36 +0000
commitd9eae8001157b255307b6754737968db12b9c9ba (patch)
tree6b4a67f1378696aac5604da427847b64e554c193 /lib/tempfile.rb
parent3f5fbc6c34fa9a4e63e3892b7962692dff8d9159 (diff)
* lib/tempfile.rb (Tempfile#initialize): merge mode option.
* lib/tmpdir.rb (Dir::Tmpname#create): splat options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tempfile.rb')
-rwxr-xr-xlib/tempfile.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 4ebeea2..7024bd9 100755
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -133,9 +133,11 @@ class Tempfile < DelegateClass(File)
create(basename, *rest) do |tmpname, n, opts|
lock = tmpname + '.lock'
+ mode = opts.delete(:mode) || 0
+ mode = File::RDWR|File::CREAT|File::EXCL|mode
self.class.mkdir(lock)
begin
- @data[1] = @tmpfile = File.open(tmpname, File::RDWR|File::CREAT|File::EXCL, 0600, *opts)
+ @data[1] = @tmpfile = File.open(tmpname, mode, 0600, *opts)
@data[0] = @tmpname = tmpname
ensure
self.class.rmdir(lock)