class Grit::GitRuby::GitObject
base class for all git objects (blob, tree, commit, tag)
Attributes
repository[RW]
sha[RW]
Public Class Methods
from_raw(rawobject, repository = nil)
click to toggle source
# File lib/grit/git-ruby/git_object.rb, line 54 def GitObject.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
new()
click to toggle source
# File lib/grit/git-ruby/git_object.rb, line 69 def initialize raise NotImplemented, "abstract class" end
Public Instance Methods
raw_content()
click to toggle source
# File lib/grit/git-ruby/git_object.rb, line 77 def raw_content raise NotImplemented, "abstract class" end
sha1()
click to toggle source
# File lib/grit/git-ruby/git_object.rb, line 81 def sha1 Digest::SHA1.hexdigest("%s %d\0" % [self.type, self.raw_content.length] + self.raw_content) end
type()
click to toggle source
# File lib/grit/git-ruby/git_object.rb, line 73 def type raise NotImplemented, "abstract class" end