diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-04-04 12:03:13 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-04-04 12:20:43 +0000 |
commit | a881b33818b101ad097cd0158afda11b6c24f1fc (patch) | |
tree | 73111721667233a91e214e4df703d91ab19cfded /lib/rubygems/package | |
parent | a78e0ca968115cbf57228cf2c026d2e21534dc7b (diff) |
[rubygems/rubygems] util/rubocop -A --only Performance/RegexpMatch
https://github.com/rubygems/rubygems/commit/52ae4452c2
Diffstat (limited to 'lib/rubygems/package')
-rw-r--r-- | lib/rubygems/package/tar_header.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb index 0bec8f4845..11d66210a4 100644 --- a/lib/rubygems/package/tar_header.rb +++ b/lib/rubygems/package/tar_header.rb @@ -127,7 +127,7 @@ class Gem::Package::TarHeader end def self.strict_oct(str) - return str.strip.oct if str.strip =~ /\A[0-7]*\z/ + return str.strip.oct if /\A[0-7]*\z/.match?(str.strip) raise ArgumentError, "#{str.inspect} is not an octal string" end @@ -137,7 +137,7 @@ class Gem::Package::TarHeader # \ff flags a negative 256-based number # In case we have a match, parse it as a signed binary value # in big-endian order, except that the high-order bit is ignored. - return str.unpack("N2").last if str =~ /\A[\x80\xff]/n + return str.unpack("N2").last if /\A[\x80\xff]/n.match?(str) strict_oct(str) end |