Class: Net::WebMockNetBufferedIO

Inherits:
BufferedIO
  • Object
show all
Defined in:
lib/webmock/http_lib_adapters/net_http.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, debug_output = nil) ⇒ WebMockNetBufferedIO

Returns a new instance of WebMockNetBufferedIO.



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/webmock/http_lib_adapters/net_http.rb', line 244

def initialize(io, debug_output = nil)
  @read_timeout = 60
  @rbuf = ''
  @debug_output = debug_output

  @io = case io
  when Socket, OpenSSL::SSL::SSLSocket, IO
    io
  when StringIO
    PatchedStringIO.new(io.string)
  when String
    PatchedStringIO.new(io)
  end
  raise "Unable to create local socket" unless @io
end