Class: GitDB::Objects::Tree
- Inherits:
-
Base
- Object
- Base
- GitDB::Objects::Tree
show all
- Defined in:
- lib/git-db/objects/tree.rb
Instance Attribute Summary
Attributes inherited from Base
#data
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #inspect, #sha
Instance Method Details
#entries ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/git-db/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 = GitDB.sha1_to_hex(stream.read(20))
entries << GitDB::Objects::Entry.new(sha, perms, name)
end
entries
end
end
|
#properties ⇒ Object
19
20
21
|
# File 'lib/git-db/objects/tree.rb', line 19
def properties
[:entries]
end
|
#raw ⇒ Object
23
24
25
|
# File 'lib/git-db/objects/tree.rb', line 23
def raw
"tree #{data.length}\000#{data}"
end
|
#type ⇒ Object
27
28
29
|
# File 'lib/git-db/objects/tree.rb', line 27
def type
GitDB::OBJ_TREE
end
|