lib/symmetric_encryption/writer.rb in symmetric-encryption-4.3.2 vs lib/symmetric_encryption/writer.rb in symmetric-encryption-4.3.3

- old
+ new

@@ -49,12 +49,12 @@ # end def self.open(file_name_or_stream, compress: nil, **args) if file_name_or_stream.is_a?(String) file_name_or_stream = ::File.open(file_name_or_stream, "wb") compress = !(/\.(zip|gz|gzip|xls.|)\z/i === file_name_or_stream) if compress.nil? - else - compress = true if compress.nil? + elsif compress.nil? + compress = true end begin file = new(file_name_or_stream, compress: compress, **args) file = Zlib::GzipWriter.new(file) if compress @@ -103,10 +103,11 @@ end # Cipher to encrypt the random_key, or the entire file cipher = SymmetricEncryption.cipher(version) unless cipher - raise(SymmetricEncryption::CipherError, "Cipher with version:#{version} not found in any of the configured SymmetricEncryption ciphers") + raise(SymmetricEncryption::CipherError, + "Cipher with version:#{version} not found in any of the configured SymmetricEncryption ciphers") end # Force header if compressed or using random iv, key if (header == true) || compress || random_key || random_iv header = Header.new(version: cipher.version, compress: compress, cipher_name: cipher_name)