ruby-changes:59070
From: aycabta <ko1@a...>
Date: Thu, 5 Dec 2019 09:03:51 +0900 (JST)
Subject: [ruby-changes:59070] ad8fbf444a (master): Fix variable catch
https://git.ruby-lang.org/ruby.git/commit/?id=ad8fbf444a From ad8fbf444abdf1480d87c95b2868741f98eb953f Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Wed, 4 Dec 2019 22:26:40 +0900 Subject: Fix variable catch diff --git a/lib/reline/config.rb b/lib/reline/config.rb index 315a3d1..04357c3 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -184,7 +184,7 @@ class Reline::Config https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L184 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 ce2fa40..dd5142d 100644 --- a/test/reline/test_config.rb +++ b/test/reline/test_config.rb @@ -28,6 +28,14 @@ class Reline::Config::Test < Reline::TestCase https://github.com/ruby/ruby/blob/trunk/test/reline/test_config.rb#L28 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/