Class: URI::SshGit::Generic

Inherits:
Generic
  • Object
show all
Defined in:
lib/uri/ssh_git/generic.rb

Overview

Instance Method Summary collapse

Instance Method Details

#to_sString

Returns git repository url via ssh protocol.

Examples:

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

Returns:

  • (String)

    git repository url via ssh protocol



14
15
16
17
# File 'lib/uri/ssh_git/generic.rb', line 14

def to_s
  show_path = path.slice(1..-1) if path.start_with?('/')
  "#{user}@#{host}:#{show_path}"
end