summaryrefslogtreecommitdiff
path: root/lib/irb/completion.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/completion.rb')
-rw-r--r--lib/irb/completion.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 099dd85627..d1bb82122e 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -7,8 +7,6 @@
# From Original Idea of shugo@ruby-lang.org
#
-autoload :RDoc, "rdoc"
-
require_relative 'ruby-lex'
module IRB
@@ -329,13 +327,22 @@ module IRB
end
PerfectMatchedProc = ->(matched, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding) {
+ begin
+ require 'rdoc'
+ rescue LoadError
+ return
+ end
+
RDocRIDriver ||= RDoc::RI::Driver.new
+
if matched =~ /\A(?:::)?RubyVM/ and not ENV['RUBY_YES_I_AM_NOT_A_NORMAL_USER']
IRB.__send__(:easter_egg)
return
end
+
namespace = retrieve_completion_data(matched, bind: bind, doc_namespace: true)
return unless namespace
+
if namespace.is_a?(Array)
out = RDoc::Markup::Document.new
namespace.each do |m|