Class: Net::SSH::Connection::Session
- Inherits:
-
Object
- Object
- Net::SSH::Connection::Session
- Defined in:
- lib/net/sftp.rb
Instance Method Summary collapse
-
#sftp(wait = true) ⇒ Object
A convenience method for starting up a new SFTP connection on the current SSH session.
Instance Method Details
#sftp(wait = true) ⇒ Object
A convenience method for starting up a new SFTP connection on the current SSH session. Blocks until the SFTP session is fully open, and then returns the SFTP session.
Net::SSH.start("localhost", "user", "password") do |ssh|
ssh.sftp.upload!("/local/file.tgz", "/remote/file.tgz")
ssh.exec! "cd /some/path && tar xf /remote/file.tgz && rm /remote/file.tgz"
end
63 64 65 66 67 68 69 |
# File 'lib/net/sftp.rb', line 63 def sftp(wait=true) @sftp ||= begin sftp = Net::SFTP::Session.new(self) sftp.connect! if wait sftp end end |