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