def unpack_from_socket(sock)
      read  = ""
      total = ""
      parts = {}

      directives.each_with_index do |directive, i|
        total << directive.to_s(parts)
        read << sock.read(directive.bytesize parts)
        parts[directive.name] = read.unpack(total)[i]
      end

      parts.delete(:null) {}
      parts
    end
def unpack_from_socket(sock)
      read  = ""
      total = ""
      parts = {}

      directives.each_with_index do |directive, i|
        total << directive.to_s(parts)
        read << sock.read(directive.bytesize parts)
        parts[directive.name] = read.unpack(total)[i]
      end

      parts.delete(:null) {}
      parts
    end
Unpacks from a socket.

 @param sock [#read] the socket to unpack from.
 @return [Hash<Symbol, Object>] the unpacked data.