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
rubocop:enable Metrics/AbcSize.
-
#triplet? ⇒ Boolean
Use the same regular expressions that the parser uses to determine if this is a valid triplet.
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
9 10 11 |
# File 'lib/uri/triplets.rb', line 9 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/uri/triplets.rb', line 9 def path @path end |
#scheme ⇒ Object
Returns the value of attribute scheme.
9 10 11 |
# File 'lib/uri/triplets.rb', line 9 def scheme @scheme end |
#user ⇒ Object
Returns the value of attribute user.
9 10 11 |
# File 'lib/uri/triplets.rb', line 9 def user @user end |
Instance Method Details
#to_s ⇒ Object
rubocop:enable Metrics/AbcSize
39 40 41 42 43 |
# File 'lib/uri/triplets.rb', line 39 def to_s return triplet if triplet? rfc_uri end |
#triplet? ⇒ Boolean
Use the same regular expressions that the parser uses to determine if this is a valid triplet.
47 48 49 50 51 52 |
# File 'lib/uri/triplets.rb', line 47 def triplet? # False if self matches a normal URI scheme rfc_uri !~ URI.parser.const_get(:SCHEME) && # False unless self matches a Triplet scheme !!(triplet =~ URI.parser.const_get(:TRIPLET)) end |