Module: Net::SSH

Defined in:
lib/extensions/net/ssh.rb,
lib/net/ssh/local.rb,
lib/net/ssh/local/version.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Local

Class Method Summary collapse

Class Method Details

.start(host, user = nil, options = {}) {|connection| ... } ⇒ Object

Custom behaviour for localhost with no user: nothing to log in with

Yields:

  • (connection)


8
9
10
11
12
13
14
15
16
# File 'lib/extensions/net/ssh.rb', line 8

def self.start(host, user=nil, options={}, &block)
  return original_start(host, user, options, &block) unless host == 'localhost' && user.nil?

  transport = Transport::Session.new(host, options)
  connection = Connection::Session.new(transport, {})      
  return connection unless block_given?

  yield connection
end