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



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

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

#closeObject



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

def close
  @socket.close
end

#closed?Boolean

Returns:

  • (Boolean)


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

def closed?
  @socket.closed?
end

#eof?Boolean

Returns:

  • (Boolean)


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

def eof?
  @socket.eof?
end

#flushObject



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

def flush
  @socket.flush
end

#gets(*args) ⇒ Object



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

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

#initialize(socket, *args) ⇒ Object



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

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

#read(*args) ⇒ Object



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

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

#readpartial(*args) ⇒ Object



439
440
441
442
443
444
445
446
# File 'lib/httpclient/session.rb', line 439

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

#syncObject



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

def sync
  @socket.sync
end

#sync=(sync) ⇒ Object



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

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