Class Zip::ZipExtraField::Generic
In: lib/zip/zip.rb
Parent: Object

Meta class for extra fields

Methods

Public Class methods

[Source]

# File lib/zip/zip.rb, line 1677
      def self.name
        self.to_s.split("::")[-1]
      end

[Source]

# File lib/zip/zip.rb, line 1671
      def self.register_map
        if self.const_defined?(:HEADER_ID)
          ID_MAP[self.const_get(:HEADER_ID)] = self
        end
      end

Public Instance methods

[Source]

# File lib/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

return field [size, content] or false

[Source]

# File lib/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

[Source]

# File lib/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

[Source]

# File lib/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

[Validate]