Class: Net::WebMockNetBufferedIO
- Inherits:
-
BufferedIO
- Object
- BufferedIO
- Net::WebMockNetBufferedIO
- Defined in:
- lib/webmock/http_lib_adapters/net_http.rb
Instance Method Summary collapse
-
#initialize(io, *args) ⇒ WebMockNetBufferedIO
constructor
A new instance of WebMockNetBufferedIO.
- #rbuf_fill ⇒ Object
Constructor Details
#initialize(io, *args) ⇒ WebMockNetBufferedIO
Returns a new instance of WebMockNetBufferedIO.
260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/webmock/http_lib_adapters/net_http.rb', line 260 def initialize(io, *args) 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 super end |
Instance Method Details
#rbuf_fill ⇒ Object
275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/webmock/http_lib_adapters/net_http.rb', line 275 def rbuf_fill current_thread_id = Thread.current.object_id trace = TracePoint.trace(:line) do |tp| next unless Thread.current.object_id == current_thread_id if tp.binding.local_variable_defined?(:tmp) tp.binding.local_variable_set(:tmp, nil) end end super ensure trace.disable end |