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



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

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

#closeObject



369
370
371
# File 'lib/httpclient/session.rb', line 369

def close
  @socket.close
end

#closed?Boolean

Returns:

  • (Boolean)


373
374
375
# File 'lib/httpclient/session.rb', line 373

def closed?
  @socket.closed?
end

#eof?Boolean

Returns:

  • (Boolean)


377
378
379
# File 'lib/httpclient/session.rb', line 377

def eof?
  @socket.eof?
end

#flushObject



402
403
404
# File 'lib/httpclient/session.rb', line 402

def flush
  @socket.flush
end

#gets(*args) ⇒ Object



381
382
383
# File 'lib/httpclient/session.rb', line 381

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

#initialize(socket, *args) ⇒ Object



364
365
366
367
# File 'lib/httpclient/session.rb', line 364

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

#read(*args) ⇒ Object



385
386
387
# File 'lib/httpclient/session.rb', line 385

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

#readpartial(*args) ⇒ Object



389
390
391
392
393
394
395
396
# File 'lib/httpclient/session.rb', line 389

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

#syncObject



406
407
408
# File 'lib/httpclient/session.rb', line 406

def sync
  @socket.sync
end

#sync=(sync) ⇒ Object



410
411
412
# File 'lib/httpclient/session.rb', line 410

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