Fix Style/UnpackFirst cop.
This commit is contained in:
parent
4e1b679c73
commit
2dfe092728
|
@ -335,15 +335,6 @@ Style/TrailingCommaInHashLiteral:
|
|||
Exclude:
|
||||
- 'lib/zip/constants.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
Style/UnpackFirst:
|
||||
Exclude:
|
||||
- 'lib/zip/entry.rb'
|
||||
- 'lib/zip/extra_field.rb'
|
||||
- 'lib/zip/extra_field/generic.rb'
|
||||
- 'lib/zip/extra_field/zip64.rb'
|
||||
|
||||
# Offense count: 247
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
|
|
|
@ -194,15 +194,15 @@ module Zip
|
|||
|
||||
class << self
|
||||
def read_zip_short(io) # :nodoc:
|
||||
io.read(2).unpack('v')[0]
|
||||
io.read(2).unpack1('v')
|
||||
end
|
||||
|
||||
def read_zip_long(io) # :nodoc:
|
||||
io.read(4).unpack('V')[0]
|
||||
io.read(4).unpack1('V')
|
||||
end
|
||||
|
||||
def read_zip_64_long(io) # :nodoc:
|
||||
io.read(8).unpack('Q<')[0]
|
||||
io.read(8).unpack1('Q<')
|
||||
end
|
||||
|
||||
def read_c_dir_entry(io) #:nodoc:all
|
||||
|
|
|
@ -40,7 +40,7 @@ module Zip
|
|||
i = 0
|
||||
while i < binstr.bytesize
|
||||
id = binstr[i, 2]
|
||||
len = binstr[i + 2, 2].to_s.unpack('v').first
|
||||
len = binstr[i + 2, 2].to_s.unpack1('v')
|
||||
if id && ID_MAP.member?(id)
|
||||
extra_field_type_exist(binstr, id, len, i)
|
||||
elsif id
|
||||
|
|
|
@ -19,7 +19,7 @@ module Zip
|
|||
return false
|
||||
end
|
||||
|
||||
[binstr[2, 2].unpack('v')[0], binstr[4..-1]]
|
||||
[binstr[2, 2].unpack1('v'), binstr[4..-1]]
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
|
|
|
@ -46,7 +46,7 @@ module Zip
|
|||
end
|
||||
|
||||
def extract(size, format)
|
||||
@content.slice!(0, size).unpack(format)[0]
|
||||
@content.slice!(0, size).unpack1(format)
|
||||
end
|
||||
private :extract
|
||||
|
||||
|
|
Loading…
Reference in New Issue