Class Grit::GitRuby::Object
In: lib/grit/git-ruby/object.rb
Parent: Object

base class for all git objects (blob, tree, commit, tag)

Methods

from_raw   new   raw_content   sha1   type  

Attributes

repository  [RW] 

Public Class methods

[Source]

# File lib/grit/git-ruby/object.rb, line 43
    def Object.from_raw(rawobject, repository = nil)      
      case rawobject.type
      when :blob
        return Blob.from_raw(rawobject, repository)
      when :tree
        return Tree.from_raw(rawobject, repository)
      when :commit
        return Commit.from_raw(rawobject, repository)
      when :tag
        return Tag.from_raw(rawobject, repository)
      else
        raise RuntimeError, "got invalid object-type"
      end
    end

[Source]

# File lib/grit/git-ruby/object.rb, line 58
    def initialize
      raise NotImplemented, "abstract class"
    end

Public Instance methods

[Source]

# File lib/grit/git-ruby/object.rb, line 66
    def raw_content
      raise NotImplemented, "abstract class"
    end

[Source]

# File lib/grit/git-ruby/object.rb, line 70
    def sha1
      Digest::SHA1.hexdigest("%s %d\0" % \
                             [self.type, self.raw_content.length] + \
                             self.raw_content)
    end

[Source]

# File lib/grit/git-ruby/object.rb, line 62
    def type
      raise NotImplemented, "abstract class"
    end

[Validate]