From 02f2b114325f45a918a53d752b33c39154ffdf3f Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Mon, 21 Oct 2024 14:48:01 -0400 Subject: [PATCH] Accept keyword splat options for server initialization --- lib/ruby_lsp/base_server.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ruby_lsp/base_server.rb b/lib/ruby_lsp/base_server.rb index 6922f0438..b97bea824 100644 --- a/lib/ruby_lsp/base_server.rb +++ b/lib/ruby_lsp/base_server.rb @@ -8,9 +8,9 @@ class BaseServer abstract! - sig { params(test_mode: T::Boolean).void } - def initialize(test_mode: false) - @test_mode = T.let(test_mode, T::Boolean) + sig { params(options: T::Boolean).void } + def initialize(**options) + @test_mode = T.let(options[:test_mode], T.nilable(T::Boolean)) @writer = T.let(Transport::Stdio::Writer.new, Transport::Stdio::Writer) @reader = T.let(Transport::Stdio::Reader.new, Transport::Stdio::Reader) @incoming_queue = T.let(Thread::Queue.new, Thread::Queue) @@ -22,7 +22,7 @@ def initialize(test_mode: false) @store = T.let(Store.new, Store) @outgoing_dispatcher = T.let( Thread.new do - unless test_mode + unless @test_mode while (message = @outgoing_queue.pop) @mutex.synchronize { @writer.write(message.to_hash) } end