summaryrefslogtreecommitdiff
path: root/lib/reline/config.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-02 12:06:49 +0900
committeraycabta <aycabta@gmail.com>2019-06-02 22:58:05 +0900
commita1e6e45341d70c608b7b5af98be0f234fd0072fb (patch)
tree8802e8e62f7733126b22e2021d925e4d2c65202d /lib/reline/config.rb
parent4fda39fc8788cbcdd07f04768ec84faf3ea44721 (diff)
Prefer $INPUTRC over the default in the home
Closes: https://github.com/ruby/ruby/pull/2222
Diffstat (limited to 'lib/reline/config.rb')
-rw-r--r--lib/reline/config.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/reline/config.rb b/lib/reline/config.rb
index 6330f777d3..7c51535a12 100644
--- a/lib/reline/config.rb
+++ b/lib/reline/config.rb
@@ -3,7 +3,7 @@ require 'pathname'
class Reline::Config
attr_reader :test_mode
- DEFAULT_PATH = Pathname.new(Dir.home).join('.inputrc')
+ DEFAULT_PATH = '~/.inputrc'
VARIABLE_NAMES = %w{
bind-tty-special-chars
@@ -77,8 +77,8 @@ class Reline::Config
@key_actors[@keymap_label]
end
- def read(file = DEFAULT_PATH)
- file = ENV['INPUTRC'] if ENV['INPUTRC']
+ def read(file = nil)
+ file ||= File.expand_path(ENV['INPUTRC'] || DEFAULT_PATH)
begin
if file.respond_to?(:readlines)
lines = file.readlines