Sha256: db1f97592798e6b80eab2346e6f54b33d2ce2adbc3ec4333f4efa9b1682b2c37

Contents?: true

Size: 724 Bytes

Versions: 69

Compression:

Stored size: 724 Bytes

Contents

module Zip
  # Info-ZIP Extra for UNIX uid/gid
  class ExtraField::IUnix < ExtraField::Generic
    HEADER_ID = 'Ux'
    register_map

    def initialize(binstr = nil)
      @uid = 0
      @gid = 0
      binstr && merge(binstr)
    end

    attr_accessor :uid, :gid

    def merge(binstr)
      return if binstr.empty?
      size, content = initial_parse(binstr)
      # size: 0 for central directory. 4 for local header
      return if !size || size == 0
      uid, gid = content.unpack('vv')
      @uid ||= uid
      @gid ||= gid
    end

    def ==(other)
      @uid == other.uid && @gid == other.gid
    end

    def pack_for_local
      [@uid, @gid].pack('vv')
    end

    def pack_for_c_dir
      ''
    end
  end
end

Version data entries

69 entries across 55 versions & 6 rubygems

Version Path
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/gems/rubyzip-1.2.0/lib/zip/extra_field/unix.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/gems/rubyzip-1.2.0/lib/zip/extra_field/unix.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/gems/rubyzip-1.2.0/lib/zip/extra_field/unix.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rubyzip-1.2.0/lib/zip/extra_field/unix.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rubyzip-1.2.0/lib/zip/extra_field/unix.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rubyzip-1.2.0/lib/zip/extra_field/unix.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rubyzip-1.2.0/lib/zip/extra_field/unix.rb
tdiary-5.0.1 vendor/bundle/gems/rubyzip-1.2.0/lib/zip/extra_field/unix.rb
rubyzip-1.2.0 lib/zip/extra_field/unix.rb