From 976c689ad478b8010b053aa270a28bd236b8380e Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 10 Jun 2019 21:07:24 +0900 Subject: irb: defer requiring rdoc to improve the start up time --- lib/irb/completion.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/irb/completion.rb') diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 26d672847c..f75dd0ebcd 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -8,7 +8,7 @@ # require "readline" -require "rdoc" +autoload :RDoc, "rdoc" module IRB module InputCompletor # :nodoc: @@ -267,8 +267,8 @@ module IRB end end - RDocRIDriver = RDoc::RI::Driver.new PerfectMatchedProc = ->(matched) { + RDocRIDriver ||= RDoc::RI::Driver.new if matched =~ /\A(?:::)?RubyVM/ and not ENV['RUBY_YES_I_AM_NOT_A_NORMAL_USER'] File.open(File.join(__dir__, 'ruby_logo.aa')) do |f| RDocRIDriver.page do |io| -- cgit v1.2.3