Class: Async::HTTP::Body::Wrapper
- Defined in:
- lib/async/http/body/wrapper.rb
Overview
Wrapping body instance. Typically you’d override ‘#read`.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
The wrapped body.
Instance Method Summary collapse
- #close(error = nil) ⇒ Object
- #empty? ⇒ Boolean
-
#finish ⇒ Object
Buffer any remaining body.
-
#initialize(body) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #inspect ⇒ Object
- #length ⇒ Object
-
#read ⇒ Object
Read the next available chunk.
Methods inherited from Readable
Constructor Details
#initialize(body) ⇒ Wrapper
Returns a new instance of Wrapper.
28 29 30 |
# File 'lib/async/http/body/wrapper.rb', line 28 def initialize(body) @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
The wrapped body.
33 34 35 |
# File 'lib/async/http/body/wrapper.rb', line 33 def body @body end |
Instance Method Details
#close(error = nil) ⇒ Object
40 41 42 43 44 |
# File 'lib/async/http/body/wrapper.rb', line 40 def close(error = nil) @body.close(error) super end |
#empty? ⇒ Boolean
46 47 48 |
# File 'lib/async/http/body/wrapper.rb', line 46 def empty? @body.empty? end |
#finish ⇒ Object
Buffer any remaining body.
36 37 38 |
# File 'lib/async/http/body/wrapper.rb', line 36 def finish @body.finish end |
#inspect ⇒ Object
59 60 61 |
# File 'lib/async/http/body/wrapper.rb', line 59 def inspect @body.inspect end |
#length ⇒ Object
50 51 52 |
# File 'lib/async/http/body/wrapper.rb', line 50 def length @body.length end |
#read ⇒ Object
Read the next available chunk.
55 56 57 |
# File 'lib/async/http/body/wrapper.rb', line 55 def read @body.read end |