Permalink
Browse files

Don't create new class Gem::CustomRequire

Suggested by Evan Phoenix.

I'll re-propose this change later. I don't work on it with default gem
changes.
  • Loading branch information...
1 parent 018a90e commit e627cdada399997e7bbf230d1e708f6de70c113e @kou committed Oct 13, 2012
Showing with 5 additions and 17 deletions.
  1. +5 −17 lib/rubygems/core_ext/kernel_require.rb
@@ -4,22 +4,6 @@
# See LICENSE.txt for permissions.
#++
-module Gem
- class CustomRequire
- def initialize(path)
- @path = path
- end
-
- def run
- spec = Gem.find_unresolved_default_spec(@path)
- if spec
- Gem.remove_unresolved_default_spec(spec)
- gem(spec.name)
- end
- end
- end
-end
-
module Kernel
if defined?(gem_original_require) then
@@ -48,7 +32,11 @@ module Kernel
# that file has already been loaded is preserved.
def require path
- Gem::CustomRequire.new(path).run
+ spec = Gem.find_unresolved_default_spec(path)
+ if spec
+ Gem.remove_unresolved_default_spec(spec)
+ gem(spec.name)
+ end
# If there are no unresolved deps, then we can use just try
# normal require handle loading a gem from the rescue below.

0 comments on commit e627cda

Please sign in to comment.