I have the following script:
#!/usr/bin/env ruby require \'rubygems\' require \'net/ssh\' Net::SSH.start(\'host1\', \'root\', :password => \"mypassword1\
see if there's something analogous to the file(utils?) cd block syntax, otherwise just run the command in the same subshell, e.g. ssh.exec "cd /var/example/engines/; pwd" ?