Class: Async::HTTP::Faraday::BodyReadWrapper

Inherits:
Protocol::HTTP::Body::Readable
  • Object
show all
Defined in:
lib/async/http/faraday/adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(body, block_size: 4096) ⇒ BodyReadWrapper

Returns a new instance of BodyReadWrapper.



22
23
24
25
# File 'lib/async/http/faraday/adapter.rb', line 22

def initialize(body, block_size: 4096)
	@body = body
	@block_size = block_size
end

Instance Method Details

#close(error = nil) ⇒ Object



27
28
29
30
31
# File 'lib/async/http/faraday/adapter.rb', line 27

def close(error = nil)
	@body.close if @body.respond_to?(:close)
ensure
	super
end

#readObject



33
34
35
# File 'lib/async/http/faraday/adapter.rb', line 33

def read
	@body.read(@block_size)
end