lib/paperclip/io_adapters/stringio_adapter.rb in paperclip-5.1.0 vs lib/paperclip/io_adapters/stringio_adapter.rb in paperclip-5.2.0

- old
+ new

@@ -1,9 +1,15 @@ module Paperclip class StringioAdapter < AbstractAdapter - def initialize(target) - @target = target + def self.register + Paperclip.io_adapters.register self do |target| + StringIO === target + end + end + + def initialize(target, options = {}) + super cache_current_values end attr_writer :content_type @@ -22,12 +28,9 @@ destination.write(data) end destination.rewind destination end - end end -Paperclip.io_adapters.register Paperclip::StringioAdapter do |target| - StringIO === target -end +Paperclip::StringioAdapter.register