Class: HTTPClient::DebugSocket
- Inherits:
-
TCPSocket
- Object
- TCPSocket
- HTTPClient::DebugSocket
- Defined in:
- lib/httpclient.rb
Overview
HTTPClient::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.
1063 1064 1065 1066 |
# File 'lib/httpclient.rb', line 1063 def initialize(*args) super @debug_dev = nil end |
Instance Attribute Details
#debug_dev ⇒ Object
Device for logging.
1049 1050 1051 |
# File 'lib/httpclient.rb', line 1049 def debug_dev @debug_dev end |
Class Method Details
.create_socket(host, port, debug_dev) ⇒ Object
1052 1053 1054 1055 1056 1057 1058 |
# File 'lib/httpclient.rb', line 1052 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
1089 1090 1091 1092 |
# File 'lib/httpclient.rb', line 1089 def <<(str) super @debug_dev << str end |
#close ⇒ Object
1072 1073 1074 1075 |
# File 'lib/httpclient.rb', line 1072 def close super @debug_dev << '! CONNECTION CLOSED' << "\n" end |
#gets(*args) ⇒ Object
1077 1078 1079 1080 1081 |
# File 'lib/httpclient.rb', line 1077 def gets(*args) str = super @debug_dev << str if str str end |
#log_connect ⇒ Object
1068 1069 1070 |
# File 'lib/httpclient.rb', line 1068 def log_connect @debug_dev << '! CONNECTION ESTABLISHED' << "\n" end |
#read(*args) ⇒ Object
1083 1084 1085 1086 1087 |
# File 'lib/httpclient.rb', line 1083 def read(*args) str = super @debug_dev << str if str str end |