5 attr_accessor :sha, :size, :type
9 def initialize(base, sha)
12 @size = @base.lib.object_size(@sha)
17 @base.lib.object_contents(@sha)
21 self.contents.split("\n")
25 raise NotImplementedError
29 "#{@type.ljust(6)} #{@sha}"
32 def grep(string, path_limiter = nil, opts = {})
33 default = {:object => @sha, :path_limiter => path_limiter}
34 grep_options = default.merge(opts)
35 @base.lib.grep(string, grep_options)
39 Git::Log.new(self, count).object(@sha)
45 class Blob < AbstractObject
51 class Tree < AbstractObject
57 class Commit < AbstractObject
65 # if we're calling this, we don't know what type it is yet
66 # so this is our little factory method
67 def new(base, objectish)
68 sha = base.lib.revparse(objectish)
69 type = base.lib.object_type(sha)