Sha256: c14d865f28a409b93670d92b823e1938d4cc1b900b7d1aa472a56ba1a329e5ff

Contents?: true

Size: 735 Bytes

Versions: 80

Compression:

Stored size: 735 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 and 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

80 entries across 77 versions & 20 rubygems

Version Path
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
hotplate-0.1.1 lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
hotplate-0.1.0 lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
hotplate-0.0.5 lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
hotplate-0.0.4 lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
hotplate-0.0.3 lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
hotplate-0.0.1 lib/hotplate/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/rubyzip-1.1.7/lib/zip/extra_field/unix.rb
rubyzip-1.1.7 lib/zip/extra_field/unix.rb
rubyzip-1.1.6 lib/zip/extra_field/unix.rb
rubyzip-1.1.5 lib/zip/extra_field/unix.rb
rubyzip-1.1.4 lib/zip/extra_field/unix.rb
rubyzip-1.1.3 lib/zip/extra_field/unix.rb
rubyzip-1.1.2 lib/zip/extra_field/unix.rb
rubyzip-1.1.1 lib/zip/extra_field/unix.rb
rubyzip-1.1.0 lib/zip/extra_field/unix.rb
rubyzip-1.0.0 lib/zip/extra_field/unix.rb