class QuickML::MockSocket
Attributes
buffer[R]
Public Class Methods
new(str = '')
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 12 def initialize(str = '') require 'stringio' @inputs = StringIO.new(str) @buffer = [] end
Public Instance Methods
address()
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 31 def address return '127.0.0.1' end
close()
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 43 def close # Do nothing. end
closed?()
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 39 def closed? return @inputs.eof? end
eof?()
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 35 def eof? return @inputs.eof? end
hostname()
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 27 def hostname return 'localhost' end
print(*args)
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 47 def print(*args) str = args.join @buffer << str end
read(len)
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 52 def read(len) @inputs.read(len) end
result()
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 19 def result ar = [] @buffer.each {|res| ar << res.sub(/\r\n\z/, "") } return ar end
safe_gets()
click to toggle source
# File vendor/qwik/lib/qwik/mock-socket.rb, line 57 def safe_gets line = org_safe_gets return nil if line.nil? line = line.xchomp+"\r\n" return line end
Also aliased as: org_safe_gets