Use guard instead of if else construct
This commit is contained in:
parent
99d8f59eaf
commit
0fee529de5
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue