Class: Net::BufferedIO
- Inherits:
-
Object
- Object
- Net::BufferedIO
- Defined in:
- lib/fake_web/ext/net_http.rb
Instance Attribute Summary collapse
-
#full_rbuf ⇒ Object
Returns the value of attribute full_rbuf.
Instance Method Summary collapse
-
#initialize(io, debug_output = nil) ⇒ BufferedIO
constructor
A new instance of BufferedIO.
- #initialize_without_fakeweb ⇒ Object
- #rbuf_consume(len) ⇒ Object
- #rbuf_consume_without_fakeweb ⇒ Object
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_rbuf ⇒ Object
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_fakeweb ⇒ Object
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_fakeweb ⇒ Object
30 |
# File 'lib/fake_web/ext/net_http.rb', line 30 alias rbuf_consume_without_fakeweb rbuf_consume |