Module: Net::SSH

Defined in:
lib/ssh/local_session.rb

Class Method Summary collapse

Class Method Details

.with_session(options, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ssh/local_session.rb', line 5

def self.with_session(options, &block)
  if options.delete(:local)
    block.call(Net::SSH::Connection::LocalSession.new)
  else
    start(options.delete(:hostname),
          options.delete(:username),
          options.compact) do |ssh|
      block.call(ssh)
    end
  end
end