Class: QB::Util::STDIO::InService

Inherits:
Service
  • Object
show all
Defined in:
lib/qb/util/stdio.rb

Overview

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

Instance Method Summary collapse

Methods inherited from Service

#close!, #debug, #open!

Constructor Details

#initialize(name, src) ⇒ InService

Returns a new instance of InService.



158
159
160
161
# File 'lib/qb/util/stdio.rb', line 158

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

Instance Method Details

#work_in_threadObject



163
164
165
166
167
168
169
# File 'lib/qb/util/stdio.rb', line 163

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