Parent

Files

Git::Object::AbstractObject

Attributes

objectish[RW]
size[RW]
type[RW]
mode[RW]

Public Class Methods

new(base, objectish) click to toggle source
    # File lib/git/object.rb, line 12
12:       def initialize(base, objectish)
13:         @base = base
14:         @objectish = objectish.to_s
15:         @contents = nil
16:         @trees = nil
17:         @size = nil
18:         @sha = nil
19:       end

Public Instance Methods

archive(file = nil, opts = {}) click to toggle source

creates an archive of this object (tree)

    # File lib/git/object.rb, line 65
65:       def archive(file = nil, opts = {})
66:         @base.lib.archive(@objectish, file, opts)
67:       end
blob?() click to toggle source
    # File lib/git/object.rb, line 71
71:       def blob?; false; end
commit?() click to toggle source
    # File lib/git/object.rb, line 73
73:       def commit?; false; end
contents(&block) click to toggle source

Get the object’s contents. If no block is given, the contents are cached in memory and returned as a string. If a block is given, it yields an IO object (via IO::popen) which could be used to read a large file in chunks.

Use this for large files so that they are not held in memory.

    # File lib/git/object.rb, line 35
35:       def contents(&block)
36:         if block_given?
37:           @base.lib.object_contents(@objectish, &block)
38:         else
39:           @contents ||= @base.lib.object_contents(@objectish)
40:         end
41:       end
contents_array() click to toggle source
    # File lib/git/object.rb, line 43
43:       def contents_array
44:         self.contents.split("\n")
45:       end
diff(objectish) click to toggle source
    # File lib/git/object.rb, line 56
56:       def diff(objectish)
57:         Git::Diff.new(@base, @objectish, objectish)
58:       end
grep(string, path_limiter = nil, opts = {}) click to toggle source
    # File lib/git/object.rb, line 51
51:       def grep(string, path_limiter = nil, opts = {})
52:         opts = {:object => sha, :path_limiter => path_limiter}.merge(opts)
53:         @base.lib.grep(string, opts)
54:       end
log(count = 30) click to toggle source
    # File lib/git/object.rb, line 60
60:       def log(count = 30)
61:         Git::Log.new(@base, count).object(@objectish)
62:       end
sha() click to toggle source
    # File lib/git/object.rb, line 21
21:       def sha
22:         @sha ||= @base.lib.revparse(@objectish)
23:       end
size() click to toggle source
    # File lib/git/object.rb, line 25
25:       def size
26:         @size ||= @base.lib.object_size(@objectish)
27:       end
tag?() click to toggle source
    # File lib/git/object.rb, line 75
75:       def tag?; false; end
to_s() click to toggle source
    # File lib/git/object.rb, line 47
47:       def to_s
48:         @objectish
49:       end
tree?() click to toggle source
    # File lib/git/object.rb, line 69
69:       def tree?; false; end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.