Skip to content

Commit

Permalink
Fixed formatting of src/tempfile.cr
Browse files Browse the repository at this point in the history
  • Loading branch information
Ary Borenszweig committed Apr 1, 2016
1 parent d7703f2 commit e890f49
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/tempfile.cr
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ end
class Tempfile < IO::FileDescriptor
# Creates a `Tempfile` with the given filename.
def initialize(name)
tmpdir = self.class.dirname + File::SEPARATOR
tmpdir = self.class.dirname + File::SEPARATOR
@path = "#{tmpdir}#{name}.XXXXXX"
fileno = LibC.mkstemp(@path)
if fileno == -1
Expand Down Expand Up @@ -69,18 +69,18 @@ class Tempfile < IO::FileDescriptor
end
tempfile
end
# Returns the tmp dir used for tempfile

# Returns the tmp dir used for tempfile
# ```
# Tempfile.dirname # => "/tmp"
# ```
def self.dirname
def self.dirname
unless tmpdir = ENV["TMPDIR"]?
tmpdir = "/tmp"
end
tmpdir = tmpdir + File::SEPARATOR unless tmpdir.ends_with? File::SEPARATOR
File.dirname(tmpdir)
end
tmpdir = tmpdir + File::SEPARATOR unless tmpdir.ends_with? File::SEPARATOR
File.dirname(tmpdir)
end

# Deletes this tempfile.
def delete
Expand Down

0 comments on commit e890f49

Please sign in to comment.