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



455
456
457
# File 'lib/httpclient/session.rb', line 455

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

#closeObject



426
427
428
# File 'lib/httpclient/session.rb', line 426

def close
  @socket.close
end

#closed?Boolean

Returns:

  • (Boolean)


430
431
432
# File 'lib/httpclient/session.rb', line 430

def closed?
  @socket.closed?
end

#eof?Boolean

Returns:

  • (Boolean)


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

def eof?
  @socket.eof?
end

#flushObject



459
460
461
# File 'lib/httpclient/session.rb', line 459

def flush
  @socket.flush
end

#gets(*args) ⇒ Object



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

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

#initialize(socket, *args) ⇒ Object



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

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

#read(*args) ⇒ Object



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

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

#readpartial(*args) ⇒ Object



446
447
448
449
450
451
452
453
# File 'lib/httpclient/session.rb', line 446

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

#syncObject



463
464
465
# File 'lib/httpclient/session.rb', line 463

def sync
  @socket.sync
end

#sync=(sync) ⇒ Object



467
468
469
# File 'lib/httpclient/session.rb', line 467

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