Class: GitDB::Git::Objects::Tree

Inherits:
Base
  • Object
show all
Defined in:
lib/git/objects/tree.rb

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inspect, #sha

Constructor Details

This class inherits a constructor from GitDB::Git::Objects::Base

Instance Method Details

#entriesObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/git/objects/tree.rb', line 5

def entries
  @entries ||= begin
    entries = []
    stream = StringIO.new(data)
    until stream.eof?
      perms = read_until(stream, ' ').to_i
      name  = read_until(stream, 0.chr)
      sha   = Git.sha1_to_hex(stream.read(20))
      entries << GitDB::Git::Objects::Entry.new(sha, perms, name)
    end
    entries
  end
end

#rawObject



19
20
21
# File 'lib/git/objects/tree.rb', line 19

def raw
  "tree #{data.length}\000#{data}"
end

#typeObject



23
24
25
# File 'lib/git/objects/tree.rb', line 23

def type
  Git::OBJ_TREE
end