Class: Zip::ZipExtraField::IUnix
Overview
Info-ZIP Extra for UNIX uid/gid
Constant Summary collapse
- HEADER_ID =
"Ux"
Instance Attribute Summary collapse
-
#gid ⇒ Object
Returns the value of attribute gid.
-
#uid ⇒ Object
Returns the value of attribute uid.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(binstr = nil) ⇒ IUnix
constructor
A new instance of IUnix.
- #merge(binstr) ⇒ Object
- #pack_for_c_dir ⇒ Object
- #pack_for_local ⇒ Object
Methods inherited from Generic
#initial_parse, name, register_map, #to_c_dir_bin, #to_local_bin
Constructor Details
#initialize(binstr = nil) ⇒ IUnix
Returns a new instance of IUnix.
1736 1737 1738 1739 1740 |
# File 'lib/zip/zip.rb', line 1736 def initialize(binstr = nil) @uid = 0 @gid = 0 binstr and merge(binstr) end |
Instance Attribute Details
#gid ⇒ Object
Returns the value of attribute gid.
1741 1742 1743 |
# File 'lib/zip/zip.rb', line 1741 def gid @gid end |
#uid ⇒ Object
Returns the value of attribute uid.
1741 1742 1743 |
# File 'lib/zip/zip.rb', line 1741 def uid @uid end |
Instance Method Details
#==(other) ⇒ Object
1753 1754 1755 1756 |
# File 'lib/zip/zip.rb', line 1753 def ==(other) @uid == other.uid && @gid == other.gid end |
#merge(binstr) ⇒ Object
1743 1744 1745 1746 1747 1748 1749 1750 1751 |
# File 'lib/zip/zip.rb', line 1743 def merge(binstr) binstr == "" and return size, content = initial_parse(binstr) # size: 0 for central direcotry. 4 for local header return if(! size || size == 0) uid, gid = content.unpack("vv") @uid ||= uid @gid ||= gid end |
#pack_for_c_dir ⇒ Object
1762 1763 1764 |
# File 'lib/zip/zip.rb', line 1762 def pack_for_c_dir "" end |
#pack_for_local ⇒ Object
1758 1759 1760 |
# File 'lib/zip/zip.rb', line 1758 def pack_for_local [@uid, @gid].pack("vv") end |