Class: Zip::ZipExtraField::UniversalTime
Overview
Info-ZIP Additional timestamp field
Constant Summary
- HEADER_ID =
"UT"
Instance Attribute Summary (collapse)
-
- (Object) atime
Returns the value of attribute atime.
-
- (Object) ctime
Returns the value of attribute ctime.
-
- (Object) flag
Returns the value of attribute flag.
-
- (Object) mtime
Returns the value of attribute mtime.
Instance Method Summary (collapse)
- - (Object) ==(other)
-
- (UniversalTime) initialize(binstr = nil)
constructor
A new instance of UniversalTime.
- - (Object) merge(binstr)
- - (Object) pack_for_c_dir
- - (Object) pack_for_local
Methods inherited from Generic
#initial_parse, name, register_map, #to_c_dir_bin, #to_local_bin
Constructor Details
- (UniversalTime) initialize(binstr = nil)
A new instance of UniversalTime
1683 1684 1685 1686 1687 1688 1689 |
# File 'lib/zip/zip.rb', line 1683 def initialize(binstr = nil) @ctime = nil @mtime = nil @atime = nil @flag = nil binstr and merge(binstr) end |
Instance Attribute Details
- (Object) atime
Returns the value of attribute atime
1690 1691 1692 |
# File 'lib/zip/zip.rb', line 1690 def atime @atime end |
- (Object) ctime
Returns the value of attribute ctime
1690 1691 1692 |
# File 'lib/zip/zip.rb', line 1690 def ctime @ctime end |
- (Object) flag
Returns the value of attribute flag
1690 1691 1692 |
# File 'lib/zip/zip.rb', line 1690 def flag @flag end |
- (Object) mtime
Returns the value of attribute mtime
1690 1691 1692 |
# File 'lib/zip/zip.rb', line 1690 def mtime @mtime end |
Instance Method Details
- (Object) ==(other)
1702 1703 1704 1705 1706 |
# File 'lib/zip/zip.rb', line 1702 def ==(other) @mtime == other.mtime && @atime == other.atime && @ctime == other.ctime end |
- (Object) merge(binstr)
1692 1693 1694 1695 1696 1697 1698 1699 1700 |
# File 'lib/zip/zip.rb', line 1692 def merge(binstr) binstr == "" and return size, content = initial_parse(binstr) size or return @flag, mtime, atime, ctime = content.unpack("CVVV") mtime and @mtime ||= Time.at(mtime) atime and @atime ||= Time.at(atime) ctime and @ctime ||= Time.at(ctime) end |
- (Object) pack_for_c_dir
1716 1717 1718 1719 1720 |
# File 'lib/zip/zip.rb', line 1716 def pack_for_c_dir s = [@flag].pack("C") @flag & 1 == 1 and s << [@mtime.to_i].pack("V") s end |
- (Object) pack_for_local
1708 1709 1710 1711 1712 1713 1714 |
# File 'lib/zip/zip.rb', line 1708 def pack_for_local s = [@flag].pack("C") @flag & 1 != 0 and s << [@mtime.to_i].pack("V") @flag & 2 != 0 and s << [@atime.to_i].pack("V") @flag & 4 != 0 and s << [@ctime.to_i].pack("V") s end |