add_metadata (Gem::Package::TarOutput)

    # File lib/rubygems/package/tar_output.rb, line 94
      def add_metadata
        return if @metadata.nil?

        @tar_writer.add_file "metadata.gz", 0644 do |io|
          begin
            sio = @signer ? StringIO.new : nil
            gzos = Zlib::GzipWriter.new(sio || io)
            gzos.write @metadata
          ensure
            gzos.flush
            gzos.finish

            # if we have a signing key, then sign the metadata digest and return
            # the signature
            if @signer then
              digest = Gem::Security::OPT[:dgst_algo].digest sio.string
              @meta_signature = @signer.sign digest
              io.write sio.string
            end
          end
        end
      end