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:
parent
2a4bacce8c
commit
97a569c648
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue