Issue #555 has been updated by Eric Hodel.


May I commit this patch? It is correct:

Index: gem_prelude.rb
===================================================================
--- gem_prelude.rb	(revision 20650)
+++ gem_prelude.rb	(working copy)
@@ -194,7 +194,13 @@ if defined?(Gem) then
 
     module QuickLoader
 
+      @loaded_full_rubygems_library = false
+
       def self.load_full_rubygems_library
+        return if @loaded_full_rubygems_library
+
+        @loaded_full_rubygems_library = true
+
         class << Gem
           Gem::GEM_PRELUDE_METHODS.each do |method_name|
             undef_method method_name

It passes this test:

$ cat test.rb
Gem.foo rescue nil
Gem.foo rescue nil
p Gem.default_dir

$ ruby19 -v test.rb
ruby 1.9.1 (2008-12-12 revision 20648) [i386-darwin9.5.0]
"/usr/local/lib/ruby19/gems/1.9.1"


----------------------------------------
http://redmine.ruby-lang.org/issues/show/555

----------------------------------------
http://redmine.ruby-lang.org