Class: URI::Ssh::Generic

Inherits:
Generic
  • Object
show all
Defined in:
lib/dr/base/uri.rb

Instance Method Summary collapse

Instance Method Details

#check_host(_v) ⇒ Object

check_host returns false for 'foo_bar' but in ssh config this can be a valid host



58
59
60
# File 'lib/dr/base/uri.rb', line 58

def check_host(_v)
	return true
end

#to_ssh(show_path: true) ⇒ String

Returns git repository url via ssh protocol.

Examples:

Generic.build(
	userinfo: 'git',
	host: 'github.com',
	path: 'packsaddle/ruby-uri-ssh_git.git'
).to_ssh
#=> '[email protected]:packsaddle/ruby-uri-ssh_git.git'

Returns:

  • (String)

    git repository url via ssh protocol



70
71
72
73
74
75
76
# File 'lib/dr/base/uri.rb', line 70

def to_ssh(show_path: true)
	str = ''
	str << "#{user}@" if user && !user.empty?
	str << "#{host}"
	str << ":#{path}" if path and show_path
	str
end