lib/paperclip/tempfile.rb in paperclip-3.0.2 vs lib/paperclip/tempfile.rb in paperclip-3.0.3
- old
+ new
@@ -5,17 +5,19 @@
# Tempfile handles its naming scheme, it is necessary to override how
# Tempfile makes # its names so as to allow for file extensions. Idea
# taken from the comments on this blog post:
# http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions
#
- # This is Ruby 1.8.7's implementation.
- def make_tmpname(basename, n)
+ # This is Ruby 1.9.3's implementation.
+ def make_tmpname(prefix_suffix, n)
if RUBY_PLATFORM =~ /java/
- case basename
+ case prefix_suffix
+ when String
+ prefix, suffix = prefix_suffix, ''
when Array
- prefix, suffix = *basename
+ prefix, suffix = *prefix_suffix
else
- prefix, suffix = basename, ''
+ raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
end
t = Time.now.strftime("%y%m%d")
path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}-#{n}#{suffix}"
else