Class: QB::IPC::STDIO::Server::OutService

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

Overview

QB STDIO Service to proxy output from modules back to the main user process.

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:, dest:) ⇒ OutService

Returns a new instance of OutService.



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

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

Instance Method Details

#work_in_threadObject



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

def work_in_thread
  while (line = @socket.gets) do
    logger.trace "received line",
      line: line,
      dest: @dest
    
    @dest.puts line
  end
end