Class | Git::Object::AbstractObject |
In: |
lib/git/object.rb
|
Parent: | Object |
mode | [RW] | |
objectish | [RW] | |
size | [RW] | |
type | [RW] |
# File lib/git/object.rb, line 17 def initialize(base, objectish) @base = base @objectish = objectish.to_s setup end
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 36 def contents(&block) if block_given? @base.lib.object_contents(@objectish, &block) else @contents || @contents = @base.lib.object_contents(@objectish) end end
# File lib/git/object.rb, line 62 def diff(objectish) Git::Diff.new(@base, @objectish, objectish) end
# File lib/git/object.rb, line 56 def grep(string, path_limiter = nil, opts = {}) default = {:object => sha, :path_limiter => path_limiter} grep_options = default.merge(opts) @base.lib.grep(string, grep_options) end
# File lib/git/object.rb, line 66 def log(count = 30) Git::Log.new(@base, count).object(@objectish) end