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


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

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

#closeObject


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

def close
  @socket.close
end

#closed?Boolean

Returns:

  • (Boolean)

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

def closed?
  @socket.closed?
end

#eof?Boolean

Returns:

  • (Boolean)

359
360
361
# File 'lib/httpclient/session.rb', line 359

def eof?
  @socket.eof?
end

#flushObject


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

def flush
  @socket.flush
end

#gets(*args) ⇒ Object


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

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

#initialize(socket, *args) ⇒ Object


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

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

#read(*args) ⇒ Object


367
368
369
# File 'lib/httpclient/session.rb', line 367

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

#readpartial(*args) ⇒ Object


371
372
373
374
375
376
377
378
# File 'lib/httpclient/session.rb', line 371

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

#syncObject


388
389
390
# File 'lib/httpclient/session.rb', line 388

def sync
  @socket.sync
end

#sync=(sync) ⇒ Object


392
393
394
# File 'lib/httpclient/session.rb', line 392

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