Method: Git::Object::AbstractObject#contents
- Defined in:
- lib/git/object.rb
#contents(&block)
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.
41 42 43 44 45 46 47 |
# File 'lib/git/object.rb', line 41 def contents(&block) if block_given? @base.lib.cat_file_contents(@objectish, &block) else @contents ||= @base.lib.cat_file_contents(@objectish) end end |