From 97a569c648acf489c9fd5602cc4ecc8a012bb07b Mon Sep 17 00:00:00 2001 From: manga_osyo Date: Wed, 25 Aug 2021 21:56:49 +0900 Subject: [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 --- lib/reline/config.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/reline/config.rb b/lib/reline/config.rb index ee73143e0f..f970bccee7 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -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 -- cgit v1.2.3