Class: SocketInterceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/pickles_http/utils.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bufferObject (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

#flushObject



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