Fix Style/OptionalBooleanParameter cop in `Entry`.

Just an internal API so safe, and makes things a lot neater.
This commit is contained in:
Robert Haines 2021-06-08 17:13:20 +01:00
parent f76cef90f7
commit e7f0aba5ff
4 changed files with 3 additions and 4 deletions

View File

@ -109,7 +109,6 @@ Style/NumericPredicate:
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'lib/zip/entry.rb'
- 'lib/zip/file.rb'
- 'lib/zip/file_split.rb'
- 'lib/zip/output_stream.rb'

View File

@ -333,7 +333,7 @@ module Zip
@extra ? @extra.local_size : 0].pack('VvvvvvVVVvv')
end
def write_local_entry(io, rewrite = false) #:nodoc:all
def write_local_entry(io, rewrite: false) #:nodoc:all
prep_zip64_extra(true)
verify_local_header_size! if rewrite
@local_header_offset = io.tell

View File

@ -177,7 +177,7 @@ module Zip
pos = @output_stream.pos
@entry_set.each do |entry|
@output_stream.pos = entry.local_header_offset
entry.write_local_entry(@output_stream, true)
entry.write_local_entry(@output_stream, rewrite: true)
end
@output_stream.pos = pos
end

View File

@ -126,7 +126,7 @@ class ZipLocalEntryTest < MiniTest::Test
buf2 = StringIO.new
entry.size = 0x123456789ABCDEF0
entry.compressed_size = 0x0123456789ABCDEF
entry.write_local_entry(buf2, true)
entry.write_local_entry(buf2, rewrite: true)
refute_nil(entry.extra['Zip64'])
refute_equal(buf1.size, 0)
assert_equal(buf1.size, buf2.size) # it can't grow, or we'd clobber file data