Class: HTTPAccess2::DebugSocket
- Inherits:
-
TCPSocket
- Object
- TCPSocket
- HTTPAccess2::DebugSocket
- Defined in:
- lib/http-access2.rb
Overview
HTTPAccess2::DebugSocket – debugging support
Instance Attribute Summary collapse
-
#debug_dev ⇒ Object
Device for logging.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(str) ⇒ Object
- #close ⇒ Object
- #gets(*args) ⇒ Object
-
#initialize(*args) ⇒ DebugSocket
constructor
A new instance of DebugSocket.
- #log_connect ⇒ Object
- #read(*args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ DebugSocket
Returns a new instance of DebugSocket.
1108 1109 1110 1111 |
# File 'lib/http-access2.rb', line 1108 def initialize(*args) super @debug_dev = nil end |
Instance Attribute Details
#debug_dev ⇒ Object
Device for logging.
1094 1095 1096 |
# File 'lib/http-access2.rb', line 1094 def debug_dev @debug_dev end |
Class Method Details
.create_socket(host, port, debug_dev) ⇒ Object
1097 1098 1099 1100 1101 1102 1103 |
# File 'lib/http-access2.rb', line 1097 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
1134 1135 1136 1137 |
# File 'lib/http-access2.rb', line 1134 def <<(str) super @debug_dev << str end |
#close ⇒ Object
1117 1118 1119 1120 |
# File 'lib/http-access2.rb', line 1117 def close super @debug_dev << '! CONNECTION CLOSED' << "\n" end |
#gets(*args) ⇒ Object
1122 1123 1124 1125 1126 |
# File 'lib/http-access2.rb', line 1122 def gets(*args) str = super @debug_dev << str if str str end |
#log_connect ⇒ Object
1113 1114 1115 |
# File 'lib/http-access2.rb', line 1113 def log_connect @debug_dev << '! CONNECTION ESTABLISHED' << "\n" end |
#read(*args) ⇒ Object
1128 1129 1130 1131 1132 |
# File 'lib/http-access2.rb', line 1128 def read(*args) str = super @debug_dev << str if str str end |