def pack(data)
      values = []
      data.each do |k, v|
        values.push([k, v])
      end

      mapped_directives = @directives.map(&:name)

      values = values.select { |x| mapped_directives.include?(x[0]) }

      values.sort! do |a, b|
        mapped_directives.index(a[0]) <=> mapped_directives.index(b[0])
      end

      ary = values.map(&:last)
      ary.pack to_s(data)
    end
def pack(data)
      values = []
      data.each do |k, v|
        values.push([k, v])
      end

      mapped_directives = @directives.map(&:name)

      values = values.select { |x| mapped_directives.include?(x[0]) }

      values.sort! do |a, b|
        mapped_directives.index(a[0]) <=> mapped_directives.index(b[0])
      end

      ary = values.map(&:last)
      ary.pack to_s(data)
    end
Packs the given data into a string.  The keys of the data
 correspond to the names of the directives.

 @param data [Hash<Symbol, Object>] the data.
 @return [String] the packed data.