lib/rsyntaxtree/svg_graph.rb
# Create a temporary file and returns only its filename
Create a temporary file and returns only its filename
Create a temporary file and returns only its filename
def create_tempf(basename, ext, num = 10)
    flags = File::RDWR | File::CREAT | File::EXCL
    tfname = ""
    num.times do |i|
      begin
        tfname = "#{basename}.#{$$}.#{i}.#{ext}"
        tfile = File.open(tfname, flags, 0600)
      rescue Errno::EEXIST
        next
      end
      tfile.close
      return tfname
    end
  end
def create_tempf ( basename , ext , num = 10 ) flags = File :: RDWR | File :: CREAT | File :: EXCL tfname = "" num . times do | i | begin tfname = "#{basename}.#{$$}.#{i}.#{ext}" tfile = File . open ( tfname , flags , 0600 ) rescue Errno :: EEXIST next end tfile . close return tfname end end
Create a temporary file and returns only its filename
Create a temporary file and returns only its filename
basename
<not_specific>
ext
<not_specific>
num
<not_specific>