Class: Zip::ZipExtraField::Generic
- Defined in:
- lib/ruby_archive/handlers/rubyzip/zip/zip.rb
Overview
Meta class for extra fields
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initial_parse(binstr) ⇒ Object
return field [size, content] or false.
- #to_c_dir_bin ⇒ Object
- #to_local_bin ⇒ Object
Class Method Details
.name ⇒ Object
1677 1678 1679 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1677 def self.name self.to_s.split("::")[-1] end |
Instance Method Details
#==(other) ⇒ Object
1693 1694 1695 1696 1697 1698 1699 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1693 def ==(other) self.class != other.class and return false each { |k, v| v != other[k] and return false } true end |
#initial_parse(binstr) ⇒ Object
return field [size, content] or false
1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1682 def initial_parse(binstr) if ! binstr # If nil, start with empty. return false elsif binstr[0,2] != self.class.const_get(:HEADER_ID) $stderr.puts "Warning: weired extra feild header ID. skip parsing" return false end [binstr[2,2].unpack("v")[0], binstr[4..-1]] end |
#to_c_dir_bin ⇒ Object
1706 1707 1708 1709 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1706 def to_c_dir_bin s = pack_for_c_dir self.class.const_get(:HEADER_ID) + [s.length].pack("v") + s end |
#to_local_bin ⇒ Object
1701 1702 1703 1704 |
# File 'lib/ruby_archive/handlers/rubyzip/zip/zip.rb', line 1701 def to_local_bin s = pack_for_local self.class.const_get(:HEADER_ID) + [s.length].pack("v") + s end |