2019-05-13 18:00:03 -04:00
|
|
|
begin
|
|
|
|
require "readline.so"
|
|
|
|
ReadlineSo = Readline
|
|
|
|
rescue LoadError
|
|
|
|
end
|
|
|
|
|
|
|
|
def use_ext_readline # Use ext/readline as Readline
|
|
|
|
Object.send(:remove_const, :Readline) if Object.const_defined?(:Readline)
|
|
|
|
Object.const_set(:Readline, ReadlineSo)
|
|
|
|
end
|
|
|
|
|
2020-02-09 03:18:41 -05:00
|
|
|
begin
|
2019-12-02 22:54:24 -05:00
|
|
|
require "reline"
|
2020-02-09 03:18:41 -05:00
|
|
|
rescue LoadError
|
2021-07-10 08:02:26 -04:00
|
|
|
Object.class_eval {remove_const :Reline} if defined?(Reline)
|
2020-02-09 03:18:41 -05:00
|
|
|
else
|
2019-12-02 22:54:24 -05:00
|
|
|
def use_lib_reline # Use lib/reline as Readline
|
|
|
|
Reline.send(:remove_const, 'IOGate') if Reline.const_defined?('IOGate')
|
|
|
|
Reline.const_set('IOGate', Reline::GeneralIO)
|
|
|
|
Reline.send(:core).config.instance_variable_set(:@test_mode, true)
|
|
|
|
Reline.send(:core).config.reset
|
|
|
|
Object.send(:remove_const, :Readline) if Object.const_defined?(:Readline)
|
|
|
|
Object.const_set(:Readline, Reline)
|
|
|
|
end
|
2021-06-21 09:24:31 -04:00
|
|
|
|
|
|
|
def finish_using_lib_reline
|
2021-06-21 10:13:04 -04:00
|
|
|
Reline.instance_variable_set(:@core, nil)
|
2021-06-21 09:24:31 -04:00
|
|
|
end
|
2019-05-13 18:00:03 -04:00
|
|
|
end
|