To temporarily change the current working directory in Ruby, call Dir.chdir
with a block. The previous working directory will be restored when the block ends:
Dir.chdir('/usr/local') do
# do stuff in /usr/local
end
Posted by Henning Koch to makandra dev (2010-12-01 09:33)