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

[ruby/reline] Memoize path of .inputrc [Ref #319]

When `ENV["HOME"] = "foo"` on irb, an exception is raised when retrieving the path of `.inputrc`.
Memoize the path of `.inputrc` and don't get the path after the second time.

https://github.com/ruby/reline/commit/7b90b16165
This commit is contained in:
manga_osyo 2021-08-25 21:56:49 +09:00 committed by git
parent 2a4bacce8c
commit 97a569c648

View file

@ -130,8 +130,12 @@ class Reline::Config
return home_rc_path
end
private def default_inputrc_path
@default_inputrc_path ||= inputrc_path
end
def read(file = nil)
file ||= inputrc_path
file ||= default_inputrc_path
begin
if file.respond_to?(:readlines)
lines = file.readlines