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
    def self.from_raw(rawobject, repository=nil)
      raw = StringIO.new(rawobject.content)
  
      entries = []
      while !raw.eof?
        mode      = Grit::GitRuby.read_bytes_until(raw, ' ')
        file_name = Grit::GitRuby.read_bytes_until(raw, "\0")
        raw_sha   = raw.read(20)
        sha = raw_sha.unpack("H*").first
        
        entries << DirectoryEntry.new(mode, file_name, sha)
      end
      new(entries, repository)
    end

[Source]

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

[Source]

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

[Source]

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

Public Instance methods

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Validate]