method
cd
ruby latest stable - Class:
FileUtils
cd(dir, verbose: nil)private
Changes the current directory to the directory dir.
If this method is called with block, resumes to the old working directory after the block execution finished.
FileUtils .cd ('/', :verbose => true) # chdir and report it FileUtils .cd ('/') do # chdir # ... # do something end # return to original directory
# File lib/fileutils.rb, line 120
def cd(dir, verbose: nil, &block) # :yield: dir
fu_output_message "cd #{dir}" if verbose
Dir.chdir(dir, &block)
fu_output_message 'cd -' if verbose and block
end