Method: FileUtils#cd

Defined in:
lib/fileutils.rb

#cd(dir, options = {}, &block) ⇒ Object (private) Also known as: chdir

Options: verbose

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


118
119
120
121
122
123
# File 'lib/fileutils.rb', line 118

def cd(dir, options = {}, &block) # :yield: dir
  fu_check_options options, OPT_TABLE['cd']
  fu_output_message "cd #{dir}" if options[:verbose]
  Dir.chdir(dir, &block)
  fu_output_message 'cd -' if options[:verbose] and block
end