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.
36
37
38
|
# File 'lib/protocol/http/body/wrapper.rb', line 36
def initialize(body)
@body = body
end
|
Instance Attribute Details
#body ⇒ Object
41
42
43
|
# File 'lib/protocol/http/body/wrapper.rb', line 41
def body
@body
end
|
Class Method Details
.wrap(message) ⇒ Object
30
31
32
33
34
|
# File 'lib/protocol/http/body/wrapper.rb', line 30
def self.wrap(message)
if body = message.body
message.body = self.new(body)
end
end
|
Instance Method Details
#call(stream) ⇒ Object
79
80
81
|
# File 'lib/protocol/http/body/wrapper.rb', line 79
def call(stream)
@body.call(stream)
end
|
#close(error = nil) ⇒ Object
48
49
50
51
52
|
# File 'lib/protocol/http/body/wrapper.rb', line 48
def close(error = nil)
@body.close(error)
super
end
|
#empty? ⇒ Boolean
54
55
56
|
# File 'lib/protocol/http/body/wrapper.rb', line 54
def empty?
@body.empty?
end
|
#finish ⇒ Object
Buffer any remaining body.
44
45
46
|
# File 'lib/protocol/http/body/wrapper.rb', line 44
def finish
@body.finish
end
|
#inspect ⇒ Object
71
72
73
|
# File 'lib/protocol/http/body/wrapper.rb', line 71
def inspect
@body.inspect
end
|
#length ⇒ Object
62
63
64
|
# File 'lib/protocol/http/body/wrapper.rb', line 62
def length
@body.length
end
|
#read ⇒ Object
Read the next available chunk.
67
68
69
|
# File 'lib/protocol/http/body/wrapper.rb', line 67
def read
@body.read
end
|
#ready? ⇒ Boolean
58
59
60
|
# File 'lib/protocol/http/body/wrapper.rb', line 58
def ready?
@body.ready?
end
|
#stream? ⇒ Boolean
75
76
77
|
# File 'lib/protocol/http/body/wrapper.rb', line 75
def stream?
@body.stream?
end
|