Class: Protocol::HTTP1::Body::Remainder
- Inherits:
-
HTTP::Body::Readable
- Object
- HTTP::Body::Readable
- Protocol::HTTP1::Body::Remainder
- Defined in:
- lib/protocol/http1/body/remainder.rb
Instance Method Summary collapse
- #call(stream) ⇒ Object
- #close(error = nil) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(stream) ⇒ Remainder
constructor
A new instance of Remainder.
- #inspect ⇒ Object
- #join ⇒ Object
- #read ⇒ Object
Constructor Details
#initialize(stream) ⇒ Remainder
Returns a new instance of Remainder.
27 28 29 |
# File 'lib/protocol/http1/body/remainder.rb', line 27 def initialize(stream) @stream = stream end |
Instance Method Details
#call(stream) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/protocol/http1/body/remainder.rb', line 46 def call(stream) self.each do |chunk| stream.write(chunk) end stream.flush end |
#close(error = nil) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/protocol/http1/body/remainder.rb', line 35 def close(error = nil) # We can't really do anything in this case except close the connection. @stream.close super end |
#empty? ⇒ Boolean
31 32 33 |
# File 'lib/protocol/http1/body/remainder.rb', line 31 def empty? @stream.closed? end |
#inspect ⇒ Object
58 59 60 |
# File 'lib/protocol/http1/body/remainder.rb', line 58 def inspect "\#<#{self.class} #{@stream.closed? ? 'closed' : 'open'}>" end |
#join ⇒ Object
54 55 56 |
# File 'lib/protocol/http1/body/remainder.rb', line 54 def join read end |
#read ⇒ Object
42 43 44 |
# File 'lib/protocol/http1/body/remainder.rb', line 42 def read @stream.read_partial end |