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



433
434
435
# File 'lib/httpclient/session.rb', line 433

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

#closeObject



404
405
406
# File 'lib/httpclient/session.rb', line 404

def close
  @socket.close
end

#closed?Boolean

Returns:

  • (Boolean)


408
409
410
# File 'lib/httpclient/session.rb', line 408

def closed?
  @socket.closed?
end

#eof?Boolean

Returns:

  • (Boolean)


412
413
414
# File 'lib/httpclient/session.rb', line 412

def eof?
  @socket.eof?
end

#flushObject



437
438
439
# File 'lib/httpclient/session.rb', line 437

def flush
  @socket.flush
end

#gets(*args) ⇒ Object



416
417
418
# File 'lib/httpclient/session.rb', line 416

def gets(*args)
  @socket.gets(*args)
end

#initialize(socket, *args) ⇒ Object



399
400
401
402
# File 'lib/httpclient/session.rb', line 399

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

#read(*args) ⇒ Object



420
421
422
# File 'lib/httpclient/session.rb', line 420

def read(*args)
  @socket.read(*args)
end

#readpartial(*args) ⇒ Object



424
425
426
427
428
429
430
431
# File 'lib/httpclient/session.rb', line 424

def readpartial(*args)
  # StringIO doesn't support :readpartial
  if @socket.respond_to?(:readpartial)
    @socket.readpartial(*args)
  else
    @socket.read(*args)
  end
end

#syncObject



441
442
443
# File 'lib/httpclient/session.rb', line 441

def sync
  @socket.sync
end

#sync=(sync) ⇒ Object



445
446
447
# File 'lib/httpclient/session.rb', line 445

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