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

Statistics, Streamable, ZStream

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 Method Details

#closeObject

Buffer any remaining body.



37
38
39
40
41
# File 'lib/async/http/body/wrapper.rb', line 37

def close
  @body = @body.close
  
  return self
end

#empty?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/async/http/body/wrapper.rb', line 32

def empty?
  @body.empty?
end

#inspectObject



52
53
54
# File 'lib/async/http/body/wrapper.rb', line 52

def inspect
  return @body.inspect
end

#readObject

Read the next available chunk.



44
45
46
# File 'lib/async/http/body/wrapper.rb', line 44

def read
  @body.read
end

#stop(error) ⇒ Object



48
49
50
# File 'lib/async/http/body/wrapper.rb', line 48

def stop(error)
  @body.stop(error)
end