Skip to content

Instantly share code, notes, and snippets.

@sarahhodne
Created June 7, 2009 16:40
Show Gist options
  • Save sarahhodne/125390 to your computer and use it in GitHub Desktop.
Save sarahhodne/125390 to your computer and use it in GitHub Desktop.
def receive_data(data)
@buffer << data
while @buffer.include?("\x0D\x0A") && (line = @buffer.split("\x0D\x0A").first)
@handler.input(line.strip)
@buffer = @buffer.split("\x0D\x0A")[1..-1].join("\x0D\x0A")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment