lib/paperclip/tempfile.rb in kt-paperclip-5.4.0 vs lib/paperclip/tempfile.rb in kt-paperclip-6.2.0
- old
+ new
@@ -10,11 +10,12 @@
# This is Ruby 1.9.3's implementation.
def make_tmpname(prefix_suffix, n)
if RUBY_PLATFORM =~ /java/
case prefix_suffix
when String
- prefix, suffix = prefix_suffix, ''
+ prefix = prefix_suffix
+ suffix = ""
when Array
prefix, suffix = *prefix_suffix
else
raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
end
@@ -30,14 +31,12 @@
module TempfileEncoding
# This overrides Tempfile#binmode to make sure that the extenal encoding
# for binary mode is ASCII-8BIT. This behavior is what's in CRuby, but not
# in JRuby
def binmode
- set_encoding('ASCII-8BIT')
+ set_encoding("ASCII-8BIT")
super
end
end
end
-if RUBY_PLATFORM =~ /java/
- ::Tempfile.send :include, Paperclip::TempfileEncoding
-end
+::Tempfile.include Paperclip::TempfileEncoding if RUBY_PLATFORM =~ /java/