Class: SocketInterceptor
- Inherits:
-
Object
- Object
- SocketInterceptor
- Defined in:
- lib/pickles_http/utils.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(socket) ⇒ SocketInterceptor
constructor
A new instance of SocketInterceptor.
- #puts(data) ⇒ Object
Constructor Details
#initialize(socket) ⇒ SocketInterceptor
Returns a new instance of SocketInterceptor.
17 18 19 20 |
# File 'lib/pickles_http/utils.rb', line 17 def initialize(socket) @socket = socket @buffer = "" end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
15 16 17 |
# File 'lib/pickles_http/utils.rb', line 15 def buffer @buffer end |
Instance Method Details
#flush ⇒ Object
27 28 29 |
# File 'lib/pickles_http/utils.rb', line 27 def flush @socket.flush end |
#puts(data) ⇒ Object
22 23 24 25 |
# File 'lib/pickles_http/utils.rb', line 22 def puts(data) @buffer += data + "\n" @socket.puts(data) end |