Adds name with permissions mode to the tar, yielding
io for writing the file. The digest_algorithm is written
to a read-only name.sum file following the given file contents
containing the digest name and hexdigest separated by a tab.
The created digest object is returned.
# File lib/rubygems/package/tar_writer.rb, line 143
def add_file_digest name, mode, digest_algorithms # :yields: io
digests = digest_algorithms.map do |digest_algorithm|
digest = digest_algorithm.new
digest_name =
if digest.respond_to? :name then
digest.name
else
/::([^:]+)$/ =~ digest_algorithm.name
$1
end
[digest_name, digest]
end
digests = Hash[*digests.flatten]
add_file name, mode do |io|
Gem::Package::DigestIO.wrap io, digests do |digest_io|
yield digest_io
end
end
digests
end