1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix variable catch

This commit is contained in:
aycabta 2019-12-04 22:26:40 +09:00
parent fb11e6089d
commit ad8fbf444a
2 changed files with 9 additions and 1 deletions

View file

@ -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'

View file

@ -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