Method: Git::Object::AbstractObject#contents

Defined in:
lib/git/object.rb

#contents(&block) ⇒ Object

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.



37
38
39
40
41
42
43
# File 'lib/git/object.rb', line 37

def contents(&block)
  if block_given?
    @base.lib.object_contents(@objectish, &block)
  else
    @contents ||= @base.lib.object_contents(@objectish)
  end
end