Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Gem::Package::TarHeader.from
from(stream)
lib/rubygems/package/tar_header.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/rubygems/package/tar_header.rb, line 103
def self.from(stream)
header = stream.read 512
return EMPTY if header == EMPTY_HEADER
fields = header.unpack UNPACK_FORMAT
new name: fields.shift,
mode: strict_oct(fields.shift),
uid: oct_or_256based(fields.shift),
gid: oct_or_256based(fields.shift),
size: strict_oct(fields.shift),
mtime: strict_oct(fields.shift),
checksum: strict_oct(fields.shift),
typeflag: fields.shift,
linkname: fields.shift,
magic: fields.shift,
version: strict_oct(fields.shift),
uname: fields.shift,
gname: fields.shift,
devmajor: strict_oct(fields.shift),
devminor: strict_oct(fields.shift),
prefix: fields.shift,
empty: false
end
Creates a tar header from IO stream