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

ruby-changes:15551

From: nobu <ko1@a...>
Date: Fri, 23 Apr 2010 14:40:19 +0900 (JST)
Subject: [ruby-changes:15551] Ruby:r27455 (trunk): * gem_prelude.rb (Gem::QuickLoader.load_full_rubygems_library):

nobu	2010-04-23 14:37:26 +0900 (Fri, 23 Apr 2010)

  New Revision: 27455

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27455

  Log:
    * gem_prelude.rb (Gem::QuickLoader.load_full_rubygems_library):
      get rid of creating same regexps many times.
    
    * lib/rubygems/custom_require.rb (Kernel#require): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/gem_prelude.rb
    trunk/lib/rubygems/custom_require.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27454)
+++ ChangeLog	(revision 27455)
@@ -1,3 +1,10 @@
+Fri Apr 23 14:37:22 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* gem_prelude.rb (Gem::QuickLoader.load_full_rubygems_library):
+	  get rid of creating same regexps many times.
+
+	* lib/rubygems/custom_require.rb (Kernel#require): ditto.
+
 Fri Apr 23 14:07:36 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* doc/etc.rd, doc/etc.rd.ja: moved from ext/etc.
Index: gem_prelude.rb
===================================================================
--- gem_prelude.rb	(revision 27454)
+++ gem_prelude.rb	(revision 27455)
@@ -142,9 +142,7 @@
         @loaded_full_rubygems_library = true
 
         class << Gem
-          Gem::GEM_PRELUDE_METHODS.each do |method_name|
-            undef_method method_name
-          end
+          undef_method *Gem::GEM_PRELUDE_METHODS
           undef_method :const_missing
           undef_method :method_missing
         end
@@ -154,10 +152,8 @@
         end
 
         $".delete path_to_full_rubygems_library
-        $".each do |path|
-          if /#{Regexp.escape File::SEPARATOR}rubygems\.rb\z/ =~ path
-            raise LoadError, "another rubygems is already loaded from #{path}"
-          end
+        if $".any? {|path| path.end_with?('/rubygems.rb')}
+          raise LoadError, "another rubygems is already loaded from #{path}"
         end
         require 'rubygems'
       end
Index: lib/rubygems/custom_require.rb
===================================================================
--- lib/rubygems/custom_require.rb	(revision 27454)
+++ lib/rubygems/custom_require.rb	(revision 27455)
@@ -30,7 +30,7 @@
   def require(path) # :doc:
     gem_original_require path
   rescue LoadError => load_error
-    if load_error.message =~ /#{Regexp.escape path}\z/ and
+    if load_error.message.end_with?(path) and
        spec = Gem.searcher.find(path) then
       Gem.activate(spec.name, "= #{spec.version}")
       gem_original_require path

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

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