diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-26 07:13:53 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-26 07:13:53 +0000 |
commit | f7e94df0d66aff47745d189ab5a7858a92233d57 (patch) | |
tree | c332ba2a435a669f26b3c5b71c91a4c756547f79 /lib | |
parent | 0edc36b9f25e7b92c40d91858dfe4ef2bd06f796 (diff) |
lib/rubygems: explicitly clarify the type for =~ matching
RubyGems is very indifferent for type.
This change is needed for removal of `Object#=~`. [Feature #15231]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems/command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/version.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb index 1326da3961..5b8868b0cd 100644 --- a/lib/rubygems/command.rb +++ b/lib/rubygems/command.rb @@ -361,7 +361,7 @@ class Gem::Command def remove_option(name) @option_groups.each do |_, option_list| - option_list.reject! { |args, _| args.any? { |x| x =~ /^#{name}/ } } + option_list.reject! { |args, _| args.any? { |x| x.is_a?(String) && x =~ /^#{name}/ } } end end diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb index fb7609c7c6..f2f10569e8 100644 --- a/lib/rubygems/version.rb +++ b/lib/rubygems/version.rb @@ -213,7 +213,7 @@ class Gem::Version end # If version is an empty string convert it to 0 - version = 0 if version =~ /\A\s*\Z/ + version = 0 if version.is_a?(String) && version =~ /\A\s*\Z/ @version = version.to_s.strip.gsub("-",".pre.") @segments = nil |