Sha256: 2349de19073542c8b44cc0997767c68db866f73563199a473e470f276c05a74d

Contents?: true

Size: 842 Bytes

Versions: 4

Compression:

Stored size: 842 Bytes

Contents

# -*- coding: utf-8 -*-


module GitObjectBrowser

  module Models

    #   signature          4bytes PACK
    #   version            4bytes
    #   objects number     4bytes
    #   object entries     -> packed_object.rb
    #
    # https://github.com/git/git/blob/master/Documentation/technical/pack-format.txt
    class PackFile < Bindata
      def initialize(input)
        super(input)
      end

      def self.path?(relpath)
        return relpath =~ %r{\Aobjects/pack/pack-[0-9a-f]{40}.pack\z}
      end

      def parse
        signature = raw(4)
        raise 'wrong signature' if signature != 'PACK'
        @version       = int
        @object_number = int
        self
      end

      def to_hash
        return {
          :version => @version,
          :object_number => @object_number
        }
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git-object-browser-0.0.6 lib/git-object-browser/models/pack_file.rb
git-object-browser-0.0.4 lib/git-object-browser/models/pack_file.rb
git-object-browser-0.0.3 lib/git-object-browser/models/pack_file.rb
git-object-browser-0.0.2 lib/git-object-browser/models/pack_file.rb