class Zip::ExtraField::OldUnix
Olf Info-ZIP Extra for UNIX uid/gid and file timestampes
Constants
- HEADER_ID
Attributes
atime[RW]
gid[RW]
mtime[RW]
uid[RW]
Public Class Methods
new(binstr = nil)
click to toggle source
# File lib/zip/extra_field/old_unix.rb, line 7 def initialize(binstr = nil) @uid = 0 @gid = 0 @atime = nil @mtime = nil binstr && merge(binstr) end
Public Instance Methods
==(other)
click to toggle source
# File lib/zip/extra_field/old_unix.rb, line 29 def ==(other) @uid == other.uid && @gid == other.gid && @atime == other.atime && @mtime == other.mtime end
merge(binstr)
click to toggle source
# File lib/zip/extra_field/old_unix.rb, line 17 def merge(binstr) return if binstr.empty? size, content = initial_parse(binstr) # size: 0 for central directory. 4 for local header return if !size || size == 0 atime, mtime, uid, gid = content.unpack('VVvv') @uid ||= uid @gid ||= gid @atime ||= atime @mtime ||= mtime end
pack_for_c_dir()
click to toggle source
# File lib/zip/extra_field/old_unix.rb, line 40 def pack_for_c_dir [@atime, @mtime].pack('VV') end
pack_for_local()
click to toggle source
# File lib/zip/extra_field/old_unix.rb, line 36 def pack_for_local [@atime, @mtime, @uid, @gid].pack('VVvv') end