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
43:     def Object.from_raw(rawobject, repository = nil)      
44:       case rawobject.type
45:       when :blob
46:         return Blob.from_raw(rawobject, repository)
47:       when :tree
48:         return Tree.from_raw(rawobject, repository)
49:       when :commit
50:         return Commit.from_raw(rawobject, repository)
51:       when :tag
52:         return Tag.from_raw(rawobject, repository)
53:       else
54:         raise RuntimeError, "got invalid object-type"
55:       end
56:     end

[Source]

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

Public Instance methods

[Source]

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

[Source]

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

[Source]

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

[Validate]