lib/paperclip-compression/paperclip/compression.rb in paperclip-compression-0.3.12 vs lib/paperclip-compression/paperclip/compression.rb in paperclip-compression-0.3.13

- old
+ new

@@ -11,20 +11,23 @@ end end private - def make_jpeg - PaperclipCompression::Jpeg.make(@file, @options) + def content_type + first_processor? ? @file.content_type : Paperclip::ContentTypeDetector.new(@file.path).detect end - def make_png - PaperclipCompression::Png.make(@file, @options) + def first_processor? + @first_processor ||= @file.is_a?(Paperclip::AbstractAdapter) end - def content_type - @file.is_a?(Paperclip::AbstractAdapter) ? @file.content_type : Paperclip::ContentTypeDetector.new(@file.path).detect + def make_jpeg + PaperclipCompression::Jpeg.make(@file, first_processor?, @options) end - end + def make_png + PaperclipCompression::Png.make(@file, first_processor?, @options) + end + end end