Class: Net::BufferedIO

Inherits:
Object
  • Object
show all
Defined in:
lib/fake_web/ext/net_http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, debug_output = nil) ⇒ BufferedIO

Returns a new instance of BufferedIO.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fake_web/ext/net_http.rb', line 11

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

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

Instance Attribute Details

#full_rbufObject

Returns the value of attribute full_rbuf.



8
9
10
# File 'lib/fake_web/ext/net_http.rb', line 8

def full_rbuf
  @full_rbuf
end

Instance Method Details

#initialize_without_fakewebObject



10
# File 'lib/fake_web/ext/net_http.rb', line 10

alias initialize_without_fakeweb initialize

#rbuf_consume(len) ⇒ Object



31
32
33
34
35
# File 'lib/fake_web/ext/net_http.rb', line 31

def rbuf_consume(len)
  s = rbuf_consume_without_fakeweb(len)
  @full_rbuf << s
  s
end

#rbuf_consume_without_fakewebObject



30
# File 'lib/fake_web/ext/net_http.rb', line 30

alias rbuf_consume_without_fakeweb rbuf_consume