class SocksTunnel::Buffer

Public Class Methods

new() click to toggle source
# File lib/socks_tunnel/buffer.rb, line 3
def initialize
  @buffer_data = ''
end

Public Instance Methods

<<(data) click to toggle source
# File lib/socks_tunnel/buffer.rb, line 7
def <<(data)
  @buffer_data << data
end
clear() click to toggle source
# File lib/socks_tunnel/buffer.rb, line 29
def clear
  @buffer_data = ''
end
each() { |fore| ... } click to toggle source
# File lib/socks_tunnel/buffer.rb, line 11
def each
  loop do
    fore, rest = @buffer_data.split(Config.delimiter, 2)
    break unless rest
    yield fore
    @buffer_data = rest
  end
end
shift() click to toggle source
# File lib/socks_tunnel/buffer.rb, line 20
def shift
  fore, rest = @buffer_data.split(Config.delimiter, 2)
  if rest
    @buffer_data = rest
    return fore
  end
  nil
end