Preview Ruby 4.1 is a preview. It can change before the final release. 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-4.1.0-preview1/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