summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/rdoc.rb12
-rw-r--r--test/rubygems/test_gem_rdoc.rb14
2 files changed, 9 insertions, 17 deletions
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
index 977a51da01..3524b161b2 100644
--- a/lib/rubygems/rdoc.rb
+++ b/lib/rubygems/rdoc.rb
@@ -5,8 +5,6 @@ require_relative "../rubygems"
begin
require "rdoc/rubygems_hook"
module Gem
- RDoc = ::RDoc::RubygemsHook
-
##
# Returns whether RDoc defines its own install hooks through a RubyGems
# plugin. This and whatever is guarded by it can be removed once no
@@ -15,8 +13,14 @@ begin
def self.rdoc_hooks_defined_via_plugin?
Gem::Version.new(::RDoc::VERSION) >= Gem::Version.new("6.9.0")
end
- end
- Gem.done_installing(&Gem::RDoc.method(:generation_hook)) unless Gem.rdoc_hooks_defined_via_plugin?
+ if rdoc_hooks_defined_via_plugin?
+ RDoc = ::RDoc::RubyGemsHook
+ else
+ RDoc = ::RDoc::RubygemsHook
+
+ Gem.done_installing(&Gem::RDoc.method(:generation_hook))
+ end
+ end
rescue LoadError
end
diff --git a/test/rubygems/test_gem_rdoc.rb b/test/rubygems/test_gem_rdoc.rb
index c4282b309c..9ecbb7d8c3 100644
--- a/test/rubygems/test_gem_rdoc.rb
+++ b/test/rubygems/test_gem_rdoc.rb
@@ -18,19 +18,7 @@ class TestGemRDoc < Gem::TestCase
install_gem @a
- hook_class = if defined?(RDoc::RubyGemsHook)
- RDoc::RubyGemsHook
- else
- Gem::RDoc
- end
-
- @hook = hook_class.new @a
-
- begin
- hook_class.load_rdoc
- rescue Gem::DocumentError => e
- pend e.message
- end
+ @hook = Gem::RDoc.new @a
Gem.configuration[:rdoc] = nil
end