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.



174
175
176
177
# File 'lib/qb/util/stdio.rb', line 174

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

Instance Method Details

#work_in_threadObject



179
180
181
182
183
184
185
# File 'lib/qb/util/stdio.rb', line 179

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