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



333
334
335
# File 'lib/httpclient/session.rb', line 333

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

#closeObject



304
305
306
# File 'lib/httpclient/session.rb', line 304

def close
  @socket.close
end

#closed?Boolean

Returns:

  • (Boolean)


308
309
310
# File 'lib/httpclient/session.rb', line 308

def closed?
  @socket.closed?
end

#eof?Boolean

Returns:

  • (Boolean)


312
313
314
# File 'lib/httpclient/session.rb', line 312

def eof?
  @socket.eof?
end

#flushObject



337
338
339
# File 'lib/httpclient/session.rb', line 337

def flush
  @socket.flush
end

#gets(rs) ⇒ Object



316
317
318
# File 'lib/httpclient/session.rb', line 316

def gets(rs)
  @socket.gets(rs)
end

#initialize(socket, *args) ⇒ Object



299
300
301
302
# File 'lib/httpclient/session.rb', line 299

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

#read(size, buf = nil) ⇒ Object



320
321
322
# File 'lib/httpclient/session.rb', line 320

def read(size, buf = nil)
  @socket.read(size, buf)
end

#readpartial(size, buf = nil) ⇒ Object



324
325
326
327
328
329
330
331
# File 'lib/httpclient/session.rb', line 324

def readpartial(size, buf = nil)
  # StringIO doesn't support :readpartial
  if @socket.respond_to?(:readpartial)
    @socket.readpartial(size, buf)
  else
    @socket.read(size, buf)
  end
end

#syncObject



341
342
343
# File 'lib/httpclient/session.rb', line 341

def sync
  @socket.sync
end

#sync=(sync) ⇒ Object



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

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