summaryrefslogtreecommitdiff
path: root/lib/rubygems/package/tar_header.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/package/tar_header.rb')
-rw-r--r--lib/rubygems/package/tar_header.rb4
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