method
make_tmpname

v2_4_6 -
Show latest stable
-
0 notes -
Class: Tmpname
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5
- 2_6_3
- What's this?
make_tmpname((prefix, suffix), n)
public
Hide source
# File lib/tmpdir.rb, line 115 def make_tmpname((prefix, suffix), n) prefix = (String.try_convert(prefix) or raise ArgumentError, "unexpected prefix: #{prefix.inspect}") prefix = prefix.delete("#{File::SEPARATOR}#{File::ALT_SEPARATOR}") suffix &&= (String.try_convert(suffix) or raise ArgumentError, "unexpected suffix: #{suffix.inspect}") suffix &&= suffix.delete("#{File::SEPARATOR}#{File::ALT_SEPARATOR}") t = Time.now.strftime("%Y%m%d") path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}".dup path << "-#{n}" if n path << suffix if suffix path end