aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-12-04 22:26:40 +0900
committeraycabta <aycabta@gmail.com>2019-12-05 09:02:23 +0900
commitad8fbf444abdf1480d87c95b2868741f98eb953f (patch)
treebc7083d086acee2c98f9ed46d9906d4f049848c0
parentfb11e6089dbe9d995510977def038a21882bcffe (diff)
downloadruby-ad8fbf444abdf1480d87c95b2868741f98eb953f.tar.gz
Fix variable catch
-rw-r--r--lib/reline/config.rb2
-rw-r--r--test/reline/test_config.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/reline/config.rb b/lib/reline/config.rb
index 315a3d127d..04357c3694 100644
--- a/lib/reline/config.rb
+++ b/lib/reline/config.rb
@@ -184,7 +184,7 @@ class Reline::Config
def bind_variable(name, value)
case name
- when VARIABLE_NAMES then
+ when *VARIABLE_NAMES then
variable_name = :"@#{name.tr(?-, ?_)}"
instance_variable_set(variable_name, value.nil? || value == '1' || value == 'on')
when 'bell-style'
diff --git a/test/reline/test_config.rb b/test/reline/test_config.rb
index ce2fa409a1..dd5142d587 100644
--- a/test/reline/test_config.rb
+++ b/test/reline/test_config.rb
@@ -28,6 +28,14 @@ class Reline::Config::Test < Reline::TestCase
assert_equal :audible, @config.instance_variable_get(:@bell_style)
end
+ def test_read_lines_with_variable
+ @config.read_lines(<<~LINES.lines)
+ set disable-completion on
+ LINES
+
+ assert_equal true, @config.instance_variable_get(:@disable_completion)
+ end
+
def test_comment_line
@config.read_lines([" #a: error\n"])
assert_not_include @config.key_bindings, nil