Class: Net::BufferedIO

Inherits:
Object show all
Defined in:
lib/http_vanilli/net_http/override.rb

Instance Method Summary collapse

Instance Method Details

#initialize_with_http_vanilli(io, debug_output = nil) ⇒ Object Also known as: initialize



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/http_vanilli/net_http/override.rb', line 20

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

  @io = case io
  when Socket, OpenSSL::SSL::SSLSocket, IO
    io
  when String
    if !io.include?("\0") && File.exists?(io) && !File.directory?(io)
      File.open(io, "r")
    else
      StringIO.new(io)
    end
  end
  raise "Unable to create local socket" unless @io
end