Sha256: 173261f75911ddf6cc5b522a99155c7e4af8bd911dfabdd2d17e1bb3071847d3
Contents?: true
Size: 1015 Bytes
Versions: 2
Compression:
Stored size: 1015 Bytes
Contents
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))) end def read r = super lockbox.decrypt(r) if r end def size read.bytesize end def rotate_encryption! io = FileIO.new(read) io.original_filename = file.filename previous_value = enable_processing begin self.enable_processing = false store!(io) ensure self.enable_processing = previous_value end end private define_method :lockbox do @lockbox ||= Utils.build_box(self, options) end end end end end CarrierWave::Uploader::Base.extend(Lockbox::CarrierWaveExtensions)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lockbox-0.1.1 | lib/lockbox/carrier_wave_extensions.rb |
lockbox-0.1.0 | lib/lockbox/carrier_wave_extensions.rb |