Module: HTTPClient::SocketWrap

Included in:
DebugSocket, LoopBackSocket
Defined in:
lib/httpclient/session.rb

Overview

Wraps up a Socket for method interception.

Instance Method Summary collapse

Instance Method Details

#<<(str) ⇒ Object



342
343
344
# File 'lib/httpclient/session.rb', line 342

def <<(str)
  @socket << str
end

#closeObject



313
314
315
# File 'lib/httpclient/session.rb', line 313

def close
  @socket.close
end

#closed?Boolean

Returns:

  • (Boolean)


317
318
319
# File 'lib/httpclient/session.rb', line 317

def closed?
  @socket.closed?
end

#eof?Boolean

Returns:

  • (Boolean)


321
322
323
# File 'lib/httpclient/session.rb', line 321

def eof?
  @socket.eof?
end

#flushObject



346
347
348
# File 'lib/httpclient/session.rb', line 346

def flush
  @socket.flush
end

#gets(rs) ⇒ Object



325
326
327
# File 'lib/httpclient/session.rb', line 325

def gets(rs)
  @socket.gets(rs)
end

#initialize(socket, *args) ⇒ Object



308
309
310
311
# File 'lib/httpclient/session.rb', line 308

def initialize(socket, *args)
  super(*args)
  @socket = socket
end

#read(size, buf = nil) ⇒ Object



329
330
331
# File 'lib/httpclient/session.rb', line 329

def read(size, buf = nil)
  @socket.read(size, buf)
end

#readpartial(size, buf = nil) ⇒ Object



333
334
335
336
337
338
339
340
# File 'lib/httpclient/session.rb', line 333

def readpartial(size, buf = nil)
  # StringIO doesn't support :readpartial
  if @socket.respond_to?(:readpartial)
    @socket.readpartial(size, buf)
  else
    @socket.read(size, buf)
  end
end

#syncObject



350
351
352
# File 'lib/httpclient/session.rb', line 350

def sync
  @socket.sync
end

#sync=(sync) ⇒ Object



354
355
356
# File 'lib/httpclient/session.rb', line 354

def sync=(sync)
  @socket.sync = sync
end