Skip to content

Commit de14ce0

Browse files
committed
Found or raise
1 parent 9214793 commit de14ce0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/tmpdir.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Dir
1919
# Returns the operating system's temporary file path.
2020

2121
def self.tmpdir
22-
tmp = ['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @@systmpdir], ['/tmp']*2, ['.']*2].find do |name, dir = ENV[name]|
22+
['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @@systmpdir], ['/tmp']*2, ['.']*2].find do |name, dir = ENV[name]|
2323
next if !dir
2424
dir = File.expand_path(dir)
2525
stat = File.stat(dir) rescue next
@@ -33,9 +33,7 @@ def self.tmpdir
3333
else
3434
break dir
3535
end
36-
end
37-
raise ArgumentError, "could not find a temporary directory" unless tmp
38-
tmp
36+
end or raise ArgumentError, "could not find a temporary directory"
3937
end
4038

4139
# Dir.mktmpdir creates a temporary directory.

0 commit comments

Comments
 (0)