Class: HTTPAccess2::DebugSocket

Inherits:
TCPSocket
  • Object
show all
Defined in:
lib/rss-client/http-access2.rb

Overview

HTTPAccess2::DebugSocket – debugging support

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ DebugSocket

Returns a new instance of DebugSocket.



1541
1542
1543
1544
# File 'lib/rss-client/http-access2.rb', line 1541

def initialize(*args)
  super
  @debug_dev = nil
end

Instance Attribute Details

#debug_devObject

Device for logging.



1527
1528
1529
# File 'lib/rss-client/http-access2.rb', line 1527

def debug_dev
  @debug_dev
end

Class Method Details

.create_socket(host, port, debug_dev) ⇒ Object



1530
1531
1532
1533
1534
1535
1536
# File 'lib/rss-client/http-access2.rb', line 1530

def create_socket(host, port, debug_dev)
  debug_dev << "! CONNECT TO #{host}:#{port}\n"
  socket = new(host, port)
  socket.debug_dev = debug_dev
  socket.log_connect
  socket
end

Instance Method Details

#<<(str) ⇒ Object



1567
1568
1569
1570
# File 'lib/rss-client/http-access2.rb', line 1567

def <<(str)
  super
  @debug_dev << str
end

#closeObject



1550
1551
1552
1553
# File 'lib/rss-client/http-access2.rb', line 1550

def close
  super
  @debug_dev << '! CONNECTION CLOSED' << "\n"
end

#gets(*args) ⇒ Object



1555
1556
1557
1558
1559
# File 'lib/rss-client/http-access2.rb', line 1555

def gets(*args)
  str = super
  @debug_dev << str if str
  str
end

#log_connectObject



1546
1547
1548
# File 'lib/rss-client/http-access2.rb', line 1546

def log_connect
  @debug_dev << '! CONNECTION ESTABLISHED' << "\n"
end

#read(*args) ⇒ Object



1561
1562
1563
1564
1565
# File 'lib/rss-client/http-access2.rb', line 1561

def read(*args)
  str = super
  @debug_dev << str if str
  str
end