Class: WEBrick::AsyncHTTPProxyServer::QueueInput

Inherits:
IO
  • Object
show all
Defined in:
lib/jscmd/asynchttpproxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ QueueInput

Returns a new instance of QueueInput.



143
144
145
146
# File 'lib/jscmd/asynchttpproxy.rb', line 143

def initialize(queue)
  @queue = queue
  @eof = false
end

Instance Method Details

#closeObject



148
# File 'lib/jscmd/asynchttpproxy.rb', line 148

def close; end

#eof?Boolean

Returns:

  • (Boolean)


150
151
152
# File 'lib/jscmd/asynchttpproxy.rb', line 150

def eof?
  @eof
end

#popObject



154
155
156
157
158
# File 'lib/jscmd/asynchttpproxy.rb', line 154

def pop
  buf = @queue.pop
  @eof = true if buf.nil?
  buf
end

#read(len = nil) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/jscmd/asynchttpproxy.rb', line 160

def read(len = nil)
  return nil if eof?
  if len
    pop
  else
    data = ""
    while buf = pop
      data << buf
    end
    data
  end
end