Method: Git::Lib#cat_file_contents
- Defined in:
- lib/git/lib.rb
#cat_file_contents(object) ⇒ String Also known as: object_contents
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Output the contents or other properties of one or more objects.
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/git/lib.rb', line 426 def cat_file_contents(object) ('object', object) if block_given? Tempfile.create do |file| # If a block is given, write the output from the process to a temporary # file and then yield the file to the block # command('cat-file', '-p', object, out: file, err: file) file.rewind yield file end else # If a block is not given, return the file contents as a string command('cat-file', '-p', object) end end |