[前][次][番号順一覧][スレッド一覧]

ruby-changes:53771

From: mame <ko1@a...>
Date: Mon, 26 Nov 2018 16:13:58 +0900 (JST)
Subject: [ruby-changes:53771] mame:r65988 (trunk): lib/rubygems: explicitly clarify the type for =~ matching

mame	2018-11-26 16:13:53 +0900 (Mon, 26 Nov 2018)

  New Revision: 65988

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65988

  Log:
    lib/rubygems: explicitly clarify the type for =~ matching
    
    RubyGems is very indifferent for type.
    This change is needed for removal of `Object#=~`.  [Feature #15231]

  Modified files:
    trunk/lib/rubygems/command.rb
    trunk/lib/rubygems/version.rb
Index: lib/rubygems/version.rb
===================================================================
--- lib/rubygems/version.rb	(revision 65987)
+++ lib/rubygems/version.rb	(revision 65988)
@@ -213,7 +213,7 @@ class Gem::Version https://github.com/ruby/ruby/blob/trunk/lib/rubygems/version.rb#L213
     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
Index: lib/rubygems/command.rb
===================================================================
--- lib/rubygems/command.rb	(revision 65987)
+++ lib/rubygems/command.rb	(revision 65988)
@@ -361,7 +361,7 @@ class Gem::Command https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L361
 
   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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]