class Net::SCP
def self.start(host, username, options={})
SSH session is closed automatically when the block terminates. If no
top of it. If a block is given, the SCP session is yielded, and the
Starts up a new SSH connection and instantiates a new SCP session on
def self.start(host, username, options={}) session = Net::SSH.start(host, username, options) scp = new(session) if block_given? begin yield scp session.loop ensure session.close end else return scp end end