Parsing null terminated key/value ASCII strings in Ruby