Module: Triplets
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
-
#host ⇒ Object
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#to_s ⇒ Object
if self.path is a relative path, assume that this was parsed as a triplet and return a Triplet.
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
7 8 9 |
# File 'lib/uri/triplets.rb', line 7 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/uri/triplets.rb', line 7 def path @path end |
#scheme ⇒ Object
Returns the value of attribute scheme.
7 8 9 |
# File 'lib/uri/triplets.rb', line 7 def scheme @scheme end |
#user ⇒ Object
Returns the value of attribute user.
7 8 9 |
# File 'lib/uri/triplets.rb', line 7 def user @user end |
Instance Method Details
#to_s ⇒ Object
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 |