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.
1446 1447 1448 1449 1450 |
# File 'lib/zip/zip.rb', line 1446 def initialize(binstr = nil) @uid = 0 @gid = 0 binstr and merge(binstr) end |
Instance Attribute Details
#gid ⇒ Object
Returns the value of attribute gid.
1451 1452 1453 |
# File 'lib/zip/zip.rb', line 1451 def gid @gid end |
#uid ⇒ Object
Returns the value of attribute uid.
1451 1452 1453 |
# File 'lib/zip/zip.rb', line 1451 def uid @uid end |
Instance Method Details
#==(other) ⇒ Object
1463 1464 1465 1466 |
# File 'lib/zip/zip.rb', line 1463 def ==(other) @uid == other.uid && @gid == other.gid end |
#merge(binstr) ⇒ Object
1453 1454 1455 1456 1457 1458 1459 1460 1461 |
# File 'lib/zip/zip.rb', line 1453 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
1472 1473 1474 |
# File 'lib/zip/zip.rb', line 1472 def pack_for_c_dir "" end |
#pack_for_local ⇒ Object
1468 1469 1470 |
# File 'lib/zip/zip.rb', line 1468 def pack_for_local [@uid, @gid].pack("vv") end |