ruby-changes:67625
From: manga_osyo <ko1@a...>
Date: Mon, 6 Sep 2021 07:06:04 +0900 (JST)
Subject: [ruby-changes:67625] 97a569c648 (master): [ruby/reline] Memoize path of `.inputrc` [Ref #319]
https://git.ruby-lang.org/ruby.git/commit/?id=97a569c648 From 97a569c648acf489c9fd5602cc4ecc8a012bb07b Mon Sep 17 00:00:00 2001 From: manga_osyo <manga.osyo@g...> 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 ee73143..f970bcc 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -130,8 +130,12 @@ class Reline::Config https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L130 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.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/