Class: GitObjectBrowser::Models::PackFile
- Defined in:
- lib/git-object-browser/models/pack_file.rb
Overview
signature 4bytes PACK
version 4bytes
objects number 4bytes
object entries -> packed_object.rb
github.com/git/git/blob/master/Documentation/technical/pack-format.txt
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input) ⇒ PackFile
constructor
A new instance of PackFile.
- #parse ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Bindata
#binstr, #byte, #bytes, #find_char, #hex, #int, #peek, #raw, #seek, #skip, #switch_source
Constructor Details
#initialize(input) ⇒ PackFile
Returns a new instance of PackFile.
15 16 17 |
# File 'lib/git-object-browser/models/pack_file.rb', line 15 def initialize(input) super(input) end |
Class Method Details
.path?(relpath) ⇒ Boolean
19 20 21 |
# File 'lib/git-object-browser/models/pack_file.rb', line 19 def self.path?(relpath) return relpath =~ %r{\Aobjects/pack/pack-[0-9a-f]{40}\.pack\z} end |
Instance Method Details
#parse ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/git-object-browser/models/pack_file.rb', line 23 def parse signature = raw(4) raise 'wrong signature' if signature != 'PACK' @version = int @object_number = int self end |
#to_hash ⇒ Object
31 32 33 34 35 36 |
# File 'lib/git-object-browser/models/pack_file.rb', line 31 def to_hash return { :version => @version, :object_number => @object_number } end |