Class: Protocol::HTTP::Body::Wrapper
Overview
Wrapping body instance. Typically you’d override ‘#read`.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Readable
#each, #join
Constructor Details
#initialize(body) ⇒ Wrapper
Returns a new instance of Wrapper.
19
20
21
|
# File 'lib/protocol/http/body/wrapper.rb', line 19
def initialize(body)
@body = body
end
|
Instance Attribute Details
#body ⇒ Object
24
25
26
|
# File 'lib/protocol/http/body/wrapper.rb', line 24
def body
@body
end
|
Class Method Details
.wrap(message) ⇒ Object
13
14
15
16
17
|
# File 'lib/protocol/http/body/wrapper.rb', line 13
def self.wrap(message)
if body = message.body
message.body = self.new(body)
end
end
|
Instance Method Details
#call(stream) ⇒ Object
62
63
64
|
# File 'lib/protocol/http/body/wrapper.rb', line 62
def call(stream)
@body.call(stream)
end
|
#close(error = nil) ⇒ Object
31
32
33
34
35
|
# File 'lib/protocol/http/body/wrapper.rb', line 31
def close(error = nil)
@body.close(error)
super
end
|
#empty? ⇒ Boolean
37
38
39
|
# File 'lib/protocol/http/body/wrapper.rb', line 37
def empty?
@body.empty?
end
|
#finish ⇒ Object
Buffer any remaining body.
27
28
29
|
# File 'lib/protocol/http/body/wrapper.rb', line 27
def finish
@body.finish
end
|
#inspect ⇒ Object
54
55
56
|
# File 'lib/protocol/http/body/wrapper.rb', line 54
def inspect
@body.inspect
end
|
#length ⇒ Object
45
46
47
|
# File 'lib/protocol/http/body/wrapper.rb', line 45
def length
@body.length
end
|
#read ⇒ Object
Read the next available chunk.
50
51
52
|
# File 'lib/protocol/http/body/wrapper.rb', line 50
def read
@body.read
end
|
#ready? ⇒ Boolean
41
42
43
|
# File 'lib/protocol/http/body/wrapper.rb', line 41
def ready?
@body.ready?
end
|
#stream? ⇒ Boolean
58
59
60
|
# File 'lib/protocol/http/body/wrapper.rb', line 58
def stream?
@body.stream?
end
|