Class: Protocol::HTTP::Body::Wrapper
- Defined in:
- lib/protocol/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.
30 31 32 |
# File 'lib/protocol/http/body/wrapper.rb', line 30 def initialize(body) @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
The wrapped body.
35 36 37 |
# File 'lib/protocol/http/body/wrapper.rb', line 35 def body @body end |
Instance Method Details
#close(error = nil) ⇒ Object
42 43 44 45 46 |
# File 'lib/protocol/http/body/wrapper.rb', line 42 def close(error = nil) @body.close(error) super end |
#empty? ⇒ Boolean
48 49 50 |
# File 'lib/protocol/http/body/wrapper.rb', line 48 def empty? @body.empty? end |
#finish ⇒ Object
Buffer any remaining body.
38 39 40 |
# File 'lib/protocol/http/body/wrapper.rb', line 38 def finish @body.finish end |
#inspect ⇒ Object
61 62 63 |
# File 'lib/protocol/http/body/wrapper.rb', line 61 def inspect @body.inspect end |
#length ⇒ Object
52 53 54 |
# File 'lib/protocol/http/body/wrapper.rb', line 52 def length @body.length end |
#read ⇒ Object
Read the next available chunk.
57 58 59 |
# File 'lib/protocol/http/body/wrapper.rb', line 57 def read @body.read end |