Flowdock
method

create

Importance_0
create(basename, tmpdir=nil, max_try: nil, **opts) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/tmpdir.rb, line 120
    def create(basename, tmpdir=nil, max_try: nil, **opts)
      if $SAFE > 0 and tmpdir.tainted?
        tmpdir = '/tmp'
      else
        tmpdir ||= tmpdir()
      end
      n = nil
      begin
        path = File.join(tmpdir, make_tmpname(basename, n))
        yield(path, n, opts)
      rescue Errno::EEXIST
        n ||= 0
        n += 1
        retry if !max_try or n < max_try
        raise "cannot generate temporary name using `#{basename}' under `#{tmpdir}'"
      end
      path
    end
Register or log in to add new notes.