summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-23 05:37:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-23 05:37:26 +0000
commit80db78f51c82cb1290e11810c8c0c03afcdf6996 (patch)
tree341678d98a7b0ded39c6d288023df029cfcb5271
parent9e67f6ecec169787bb489ccb3f71d32a141f01da (diff)
downloadbundler-80db78f51c82cb1290e11810c8c0c03afcdf6996.tar.gz
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--gem_prelude.rb10
-rw-r--r--lib/rubygems/custom_require.rb2
3 files changed, 11 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 3fcd4b9ec8..ba7ab6d15e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Apr 23 14:37:22 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* doc/etc.rd, doc/etc.rd.ja: moved from ext/etc.
diff --git a/gem_prelude.rb b/gem_prelude.rb
index 5928356afa..99dd6e5eb2 100644
--- a/gem_prelude.rb
+++ b/gem_prelude.rb
@@ -142,9 +142,7 @@ if defined?(Gem) then
@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 @@ if defined?(Gem) then
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
diff --git a/lib/rubygems/custom_require.rb b/lib/rubygems/custom_require.rb
index 78c7872b6f..43b3136b60 100644
--- a/lib/rubygems/custom_require.rb
+++ b/lib/rubygems/custom_require.rb
@@ -30,7 +30,7 @@ module Kernel
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