Class Grit::GitRuby::Tree
In: lib/grit/git-ruby/git_object.rb
lib/grit/git-ruby/object.rb
Parent: GitObject

Methods

actual_raw   actual_raw   from_raw   from_raw   new   new   raw_content   raw_content   type   type  

Attributes

entry  [RW] 
entry  [RW] 

Public Class methods

[Source]

     # File lib/grit/git-ruby/object.rb, line 182
182:     def self.from_raw(rawobject, repository=nil)
183:       raw = StringIO.new(rawobject.content)
184:   
185:       entries = []
186:       while !raw.eof?
187:         mode      = Grit::GitRuby.read_bytes_until(raw, ' ')
188:         file_name = Grit::GitRuby.read_bytes_until(raw, "\0")
189:         raw_sha   = raw.read(20)
190:         sha = raw_sha.unpack("H*").first
191:         
192:         entries << DirectoryEntry.new(mode, file_name, sha)
193:       end
194:       new(entries, repository)
195:     end

[Source]

     # File lib/grit/git-ruby/git_object.rb, line 198
198:     def self.from_raw(rawobject, repository=nil)
199:       raw = StringIO.new(rawobject.content)
200:   
201:       entries = []
202:       while !raw.eof?
203:         mode      = Grit::GitRuby.read_bytes_until(raw, ' ')
204:         file_name = Grit::GitRuby.read_bytes_until(raw, "\0")
205:         raw_sha   = raw.read(20)
206:         sha = raw_sha.unpack("H*").first
207:         
208:         entries << DirectoryEntry.new(mode, file_name, sha)
209:       end
210:       new(entries, repository)
211:     end

[Source]

     # File lib/grit/git-ruby/git_object.rb, line 213
213:     def initialize(entries=[], repository = nil)
214:       @entry = entries
215:       @repository = repository
216:     end

[Source]

     # File lib/grit/git-ruby/object.rb, line 197
197:     def initialize(entries=[], repository = nil)
198:       @entry = entries
199:       @repository = repository
200:     end

Public Instance methods

[Source]

     # File lib/grit/git-ruby/object.rb, line 212
212:     def actual_raw
213:       #@entry.collect { |e| e.raw.join(' '), e.name].join("\t") }.join("\n")
214:     end

[Source]

     # File lib/grit/git-ruby/git_object.rb, line 228
228:     def actual_raw
229:       #@entry.collect { |e| e.raw.join(' '), e.name].join("\t") }.join("\n")
230:     end

[Source]

     # File lib/grit/git-ruby/git_object.rb, line 222
222:     def raw_content
223:       # TODO: sort correctly
224:       #@entry.sort { |a,b| a.name <=> b.name }.
225:       @entry.collect { |e| [[e.format_mode, e.format_type, e.sha1].join(' '), e.name].join("\t") }.join("\n")
226:     end

[Source]

     # File lib/grit/git-ruby/object.rb, line 206
206:     def raw_content
207:       # TODO: sort correctly
208:       #@entry.sort { |a,b| a.name <=> b.name }.
209:       @entry.collect { |e| [[e.format_mode, e.format_type, e.sha1].join(' '), e.name].join("\t") }.join("\n")
210:     end

[Source]

     # File lib/grit/git-ruby/object.rb, line 202
202:     def type
203:       :tree
204:     end

[Source]

     # File lib/grit/git-ruby/git_object.rb, line 218
218:     def type
219:       :tree
220:     end

[Validate]