1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
mame 2018-11-26 07:13:53 +00:00
parent 0edc36b9f2
commit f7e94df0d6
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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