lib/uri/ssh_git/generic.rb in uri-ssh_git-1.0.0 vs lib/uri/ssh_git/generic.rb in uri-ssh_git-2.0.0.pre.1
- old
+ new
@@ -4,17 +4,18 @@
class Generic < ::URI::Generic
# @example
# Generic.build(
# userinfo: 'git',
# host: 'github.com',
- # path: '/packsaddle/ruby-uri-ssh_git.git'
+ # path: 'packsaddle/ruby-uri-ssh_git.git'
# ).to_s
# #=> 'git@github.com:packsaddle/ruby-uri-ssh_git.git'
#
# @return [String] git repository url via ssh protocol
def to_s
- show_path = path.slice(1..-1) if path.start_with?('/')
- "#{user}@#{host}:#{show_path}"
+ str = ''
+ str << "#{user}@" if user && !user.empty?
+ str << "#{host}:#{path}"
end
end
end
end