diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-22 04:44:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-22 04:44:19 +0000 |
commit | 2e2522ecdfc577f8c44850cf8ba616f456730cf7 (patch) | |
tree | 7315d2fe43077f55fe6478bb09894e0f53935eb1 /lib/tmpdir.rb | |
parent | 565fef821069ac0ef50359e372eef3ba14ce69be (diff) | |
download | ruby-2e2522ecdfc577f8c44850cf8ba616f456730cf7.tar.gz |
tmpdir.rb: explicit conversion to string
* lib/tmpdir.rb (Dir::Tmpname#make_tmpname): convert prefix and
suffix to strings explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tmpdir.rb')
-rw-r--r-- | lib/tmpdir.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb index 7bd99e1fbb..f52d092de5 100644 --- a/lib/tmpdir.rb +++ b/lib/tmpdir.rb @@ -106,6 +106,10 @@ class Dir end def make_tmpname((prefix, suffix), n) + prefix = (String.try_convert(prefix) or + raise ArgumentError, "unexpected prefix: #{prefix.inspect}") + suffix &&= (String.try_convert(suffix) or + raise ArgumentError, "unexpected suffix: #{suffix.inspect}") t = Time.now.strftime("%Y%m%d") path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}" path << "-#{n}" if n |