Class: Holistic::LanguageServer::Stdio::Server
- Inherits:
-
Object
- Object
- Holistic::LanguageServer::Stdio::Server
- Defined in:
- lib/holistic/language_server/stdio/server.rb
Instance Method Summary collapse
-
#initialize(input = STDIN, output = STDOUT) ⇒ Server
constructor
A new instance of Server.
- #start_input_loop(&block) ⇒ Object
- #stop! ⇒ Object
- #write_to_output(payload) ⇒ Object
Constructor Details
#initialize(input = STDIN, output = STDOUT) ⇒ Server
Returns a new instance of Server.
5 6 7 8 9 10 11 12 |
# File 'lib/holistic/language_server/stdio/server.rb', line 5 def initialize(input = STDIN, output = STDOUT) @input = input @output = output @stopped = false @on_data_received = -> { raise ::NotImplementedError } set_output_to_binary_mode! end |
Instance Method Details
#start_input_loop(&block) ⇒ Object
14 15 16 17 18 |
# File 'lib/holistic/language_server/stdio/server.rb', line 14 def start_input_loop(&block) @on_data_received = block read_input until @stopped end |
#stop! ⇒ Object
25 26 27 |
# File 'lib/holistic/language_server/stdio/server.rb', line 25 def stop! @stopped = true end |
#write_to_output(payload) ⇒ Object
20 21 22 23 |
# File 'lib/holistic/language_server/stdio/server.rb', line 20 def write_to_output(payload) @output.write(payload) @output.flush end |