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



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

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

#closeObject



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

def close
  @socket.close
end

#closed?Boolean

Returns:

  • (Boolean)


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

def closed?
  @socket.closed?
end

#eof?Boolean

Returns:

  • (Boolean)


424
425
426
# File 'lib/httpclient/session.rb', line 424

def eof?
  @socket.eof?
end

#flushObject



449
450
451
# File 'lib/httpclient/session.rb', line 449

def flush
  @socket.flush
end

#gets(*args) ⇒ Object



428
429
430
# File 'lib/httpclient/session.rb', line 428

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

#initialize(socket, *args) ⇒ Object



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

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

#read(*args) ⇒ Object



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

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

#readpartial(*args) ⇒ Object



436
437
438
439
440
441
442
443
# File 'lib/httpclient/session.rb', line 436

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

#syncObject



453
454
455
# File 'lib/httpclient/session.rb', line 453

def sync
  @socket.sync
end

#sync=(sync) ⇒ Object



457
458
459
# File 'lib/httpclient/session.rb', line 457

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