Class: HTTP::Response::Streamer

Inherits:
Object
  • Object
show all
Defined in:
lib/webmock/http_lib_adapters/http_rb/streamer.rb

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Streamer

Returns a new instance of Streamer.


4
5
6
# File 'lib/webmock/http_lib_adapters/http_rb/streamer.rb', line 4

def initialize(str)
  @io = StringIO.new str
end

Instance Method Details

#closeObject


20
21
22
# File 'lib/webmock/http_lib_adapters/http_rb/streamer.rb', line 20

def close
  @io.close
end

#readpartial(size = nil, outbuf = nil) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/webmock/http_lib_adapters/http_rb/streamer.rb', line 8

def readpartial(size = nil, outbuf = nil)
  unless size
    if defined?(HTTP::Client::BUFFER_SIZE)
      size = HTTP::Client::BUFFER_SIZE
    elsif defined?(HTTP::Connection::BUFFER_SIZE)
      size = HTTP::Connection::BUFFER_SIZE
    end
  end

  @io.read size, outbuf
end

#sequence_idObject


24
25
26
# File 'lib/webmock/http_lib_adapters/http_rb/streamer.rb', line 24

def sequence_id
  -1
end