def open_tempfile_if_missing(object, &block)
      if ::FileTest.file?(object)
        ::File.open(object, &block)
      else
        tempfile = Tempfile.new('tty-file-diff')
        tempfile << object
        tempfile.rewind

        block[tempfile]

        unless tempfile.nil?
          tempfile.close
          tempfile.unlink
        end
      end
    end
def open_tempfile_if_missing(object, &block)
      if ::FileTest.file?(object)
        ::File.open(object, &block)
      else
        tempfile = Tempfile.new('tty-file-diff')
        tempfile << object
        tempfile.rewind

        block[tempfile]

        unless tempfile.nil?
          tempfile.close
          tempfile.unlink
        end
      end
    end
If content is not a path to a file, create a
 tempfile and open it instead.

 @param [String] object
   a path to file or content

 @api private