lib/lockbox/carrier_wave_extensions.rb in lockbox-0.2.3 vs lib/lockbox/carrier_wave_extensions.rb in lockbox-0.2.4
- old
+ new
@@ -1,17 +1,13 @@
class Lockbox
module CarrierWaveExtensions
- class FileIO < StringIO
- attr_accessor :original_filename
- end
-
def encrypt(**options)
class_eval do
before :cache, :encrypt
def encrypt(file)
- @file = CarrierWave::SanitizedFile.new(StringIO.new(lockbox.encrypt(file.read)))
+ @file = CarrierWave::SanitizedFile.new(lockbox.encrypt_io(file))
end
def read
r = super
lockbox.decrypt(r) if r
@@ -20,10 +16,10 @@
def size
read.bytesize
end
def rotate_encryption!
- io = FileIO.new(read)
+ io = Lockbox::IO.new(read)
io.original_filename = file.filename
previous_value = enable_processing
begin
self.enable_processing = false
store!(io)