class GQTP::Backend::Thread::IO
Public Class Methods
new(real_io)
click to toggle source
# File lib/gqtp/backend/thread.rb, line 35 def initialize(real_io) @real_io = real_io end
Public Instance Methods
close()
click to toggle source
# File lib/gqtp/backend/thread.rb, line 65 def close @real_io.close end
read(size=nil) { |data| ... }
click to toggle source
# File lib/gqtp/backend/thread.rb, line 53 def read(size=nil) thread = ::Thread.new do data = @real_io.read(size) if block_given? yield(data) else data end end Request.new(thread) end
write(*chunks) { || ... }
click to toggle source
# File lib/gqtp/backend/thread.rb, line 39 def write(*chunks) thread = ::Thread.new do chunks.each do |chunk| until chunk.empty? written_bytes = @real_io.write(chunk) break if chunk.bytesize == written_bytes chunk = chunk[written_bytes..-1] end end yield if block_given? end Request.new(thread) end