lib/lockbox/carrier_wave_extensions.rb in lockbox-0.4.3 vs lib/lockbox/carrier_wave_extensions.rb in lockbox-0.4.4

- old
+ new

@@ -3,17 +3,17 @@ def encrypt(**options) class_eval do before :cache, :encrypt def encrypt(file) - @file = CarrierWave::SanitizedFile.new(with_notification("encrypt_file") { lockbox.encrypt_io(file) }) + @file = CarrierWave::SanitizedFile.new(lockbox_notify("encrypt_file") { lockbox.encrypt_io(file) }) end # TODO safe to memoize? def read r = super - with_notification("decrypt_file") { lockbox.decrypt(r) } if r + lockbox_notify("decrypt_file") { lockbox.decrypt(r) } if r end def size read.bytesize end @@ -56,10 +56,10 @@ end uploader.class.name.sub(/Uploader\z/, "").underscore end end - def with_notification(type) + def lockbox_notify(type) if defined?(ActiveSupport::Notifications) name = lockbox_name # get version version, _ = parent_version && parent_version.versions.find { |k, v| v == self }