Class: Async::HTTP::Body::Wrapper

Inherits:
Readable
  • Object
show all
Defined in:
lib/async/http/body/wrapper.rb

Overview

Wrapping body instance. Typically you’d override ‘#read`.

Direct Known Subclasses

Delayed, Rewindable, Statistics, Streamable, ZStream

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Readable

#each, #join

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

#bodyObject (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

Returns:

  • (Boolean)


46
47
48
# File 'lib/async/http/body/wrapper.rb', line 46

def empty?
	@body.empty?
end

#finishObject

Buffer any remaining body.



36
37
38
# File 'lib/async/http/body/wrapper.rb', line 36

def finish
	@body.finish
end

#inspectObject



59
60
61
# File 'lib/async/http/body/wrapper.rb', line 59

def inspect
	@body.inspect
end

#lengthObject



50
51
52
# File 'lib/async/http/body/wrapper.rb', line 50

def length
	@body.length
end

#readObject

Read the next available chunk.



55
56
57
# File 'lib/async/http/body/wrapper.rb', line 55

def read
	@body.read
end