Class: QB::IPC::STDIO::Server::InService

Inherits:
Service
  • Object
show all
Defined in:
lib/qb/ipc/stdio/server/in_service.rb

Overview

QB STDIO Service to proxy interactive user input from the main process to modules.

Instance Attribute Summary

Attributes inherited from Service

#env_var_name, #name, #path, #server, #socket, #thread

Instance Method Summary collapse

Methods inherited from Service

#close!, #open!, #to_s

Constructor Details

#initialize(name:, socket_dir:, src:) ⇒ InService

Returns a new instance of InService.



6
7
8
9
# File 'lib/qb/ipc/stdio/server/in_service.rb', line 6

def initialize name:, socket_dir:, src:
  super name: name, socket_dir: socket_dir
  @src = src
end

Instance Method Details

#work_in_threadObject



11
12
13
14
15
16
17
# File 'lib/qb/ipc/stdio/server/in_service.rb', line 11

def work_in_thread
  while (line = @src.gets) do
    @socket.puts line
  end
  
  close!
end