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

Rewindable, Statistics, Streamable, ZStream

Instance Method Summary collapse

Methods inherited from Readable

#each, #join

Constructor Details

#initialize(body) ⇒ 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.



41
42
43
44
45
# File 'lib/async/http/body/wrapper.rb', line 41

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

#empty?Boolean



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

def empty?
  @body.empty?
end

#inspectObject



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

def inspect
  return @body.inspect
end

#lengthObject



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

def length
  @body.length
end

#readObject

Read the next available chunk.



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

def read
  @body.read
end

#stop(error) ⇒ Object



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

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