Use guard instead of if else construct

This commit is contained in:
Joni Lahtinen 2020-04-29 17:06:29 +03:00
parent 99d8f59eaf
commit 0fee529de5
1 changed files with 3 additions and 5 deletions

View File

@ -14,12 +14,10 @@ module Zip
@crc = Zlib.crc32(val, @crc) @crc = Zlib.crc32(val, @crc)
@size += val.bytesize @size += val.bytesize
buffer = @zlib_deflater.deflate(data, Zlib::SYNC_FLUSH) buffer = @zlib_deflater.deflate(data, Zlib::SYNC_FLUSH)
if buffer.empty? return @output_stream if buffer.empty?
@output_stream
else
@output_stream << @encrypter.encrypt(buffer) @output_stream << @encrypter.encrypt(buffer)
end end
end
def finish def finish
buffer = @zlib_deflater.finish buffer = @zlib_deflater.finish