Class: WEBrick::AsyncHTTPProxyServer::QueueInput
- Inherits:
-
IO
- Object
- IO
- WEBrick::AsyncHTTPProxyServer::QueueInput
- Defined in:
- lib/jscmd/asynchttpproxy.rb
Instance Method Summary collapse
- #close ⇒ Object
- #eof? ⇒ Boolean
-
#initialize(queue) ⇒ QueueInput
constructor
A new instance of QueueInput.
- #pop ⇒ Object
- #read(len = nil) ⇒ Object
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
#close ⇒ Object
148 |
# File 'lib/jscmd/asynchttpproxy.rb', line 148 def close; end |
#eof? ⇒ Boolean
150 151 152 |
# File 'lib/jscmd/asynchttpproxy.rb', line 150 def eof? @eof end |
#pop ⇒ Object
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 |