Class: Dialed::HTTP::Response::Body
- Inherits:
-
Object
- Object
- Dialed::HTTP::Response::Body
- Defined in:
- lib/dialed/http/response/body.rb
Instance Method Summary collapse
- #http2? ⇒ Boolean
-
#initialize(internal_body) ⇒ Body
constructor
A new instance of Body.
- #read ⇒ Object
- #to_io ⇒ Object
Constructor Details
#initialize(internal_body) ⇒ Body
Returns a new instance of Body.
6 7 8 9 |
# File 'lib/dialed/http/response/body.rb', line 6 def initialize(internal_body) @internal_body = internal_body @file = nil end |
Instance Method Details
#http2? ⇒ Boolean
32 |
# File 'lib/dialed/http/response/body.rb', line 32 def http2?; end |
#read ⇒ Object
11 12 13 |
# File 'lib/dialed/http/response/body.rb', line 11 def read raise NotImplementedError end |
#to_io ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dialed/http/response/body.rb', line 15 def to_io @to_io ||= begin file = nil begin file = ::Tempfile.create(anonymous: true) internal_body.each do |chunk| file.write(chunk) end file.rewind file rescue => e file.close raise e end end end |