Method: Stud::Temporary#pathname

Defined in:
lib/stud/temporary.rb

#pathname(prefix = DEFAULT_PREFIX) ⇒ Object

Returns a string for a randomly-generated temporary path.

This does not create any files.



11
12
13
14
15
# File 'lib/stud/temporary.rb', line 11

def pathname(prefix=DEFAULT_PREFIX)

  root = ENV["TMP"] || ENV["TMPDIR"] || ENV["TEMP"] || "/tmp"
  return File.join(root, "#{prefix}-#{SecureRandom.hex(30)}")
end