1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/rdoc] Delay require "readline" in case the terminal is in raw mode

This commit is contained in:
Shugo Maeda 2022-10-27 10:29:02 +09:00 committed by git
parent 739ad81ff1
commit 5129ca3e05

View file

@ -1,11 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'optparse' require 'optparse'
begin
require 'readline'
rescue LoadError
end
require_relative '../../rdoc' require_relative '../../rdoc'
require_relative 'formatter' # For RubyGems backwards compatibility require_relative 'formatter' # For RubyGems backwards compatibility
@ -1079,6 +1074,10 @@ or the PAGER environment variable.
def interactive def interactive
puts "\nEnter the method name you want to look up." puts "\nEnter the method name you want to look up."
begin
require 'readline'
rescue LoadError
end
if defined? Readline then if defined? Readline then
Readline.completion_proc = method :complete Readline.completion_proc = method :complete
puts "You can use tab to autocomplete." puts "You can use tab to autocomplete."