Module: Triplets

Included in:
URI::Git, URI::SCP, URI::SSH
Defined in:
lib/uri/triplets.rb

Overview

Triplets is a mix-in for subclasses of URI::Generic, which allows URI to use SCP-style Triplet URLs in a somewhat more meaningful way.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host.



7
8
9
# File 'lib/uri/triplets.rb', line 7

def host
  @host
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/uri/triplets.rb', line 7

def path
  @path
end

#schemeObject

Returns the value of attribute scheme.



7
8
9
# File 'lib/uri/triplets.rb', line 7

def scheme
  @scheme
end

#userObject

Returns the value of attribute user.



7
8
9
# File 'lib/uri/triplets.rb', line 7

def user
  @user
end

Instance Method Details

#to_sObject

if self.path is a relative path, assume that this was parsed as a triplet and return a Triplet. Otherwise, assume that this is a valid URI and print an RFC compliant URI. This may not be the most robust method of determining if a triplet should be used, but everything starts someplace.



39
40
41
42
# File 'lib/uri/triplets.rb', line 39

def to_s
  return triplet if relative?
  rfc_uri
end