Module: TripletInterruptus
- Included in:
- URI::Parser, URI::RFC3986_Parser
- Defined in:
- lib/uri/triplets.rb
Overview
A SCP Triplet is not a canonical URI. It doesn’t follow any RFCs that I’ve been able to find, and it’s difficult to reason about if you try to force it into a URI::Generic as-is. TripletInterruptus provides helper methods that preserve the upstream behavior of URI::Generic but extend it just enough that it doesn’t choke on SCP Triplets if they’re passed.
Constant Summary collapse
- TRIPLET =
Determine if a string can be teased apart into URI-like components
%r{\A(?:(?<userinfo>.+)[@]+)?(?<host>[\w.]+):(?<path>.*)\z}
- SCHEME =
Determine if a string is prefixed with a URI scheme like http:// or ssh://
%r{\A(?:(?<scheme>[a-z]+)://)}
Instance Method Summary collapse
Instance Method Details
#parse(uri) ⇒ Object
58 59 60 61 |
# File 'lib/uri/triplets.rb', line 58 def parse(uri) return build_triplet(uri) if triplet?(uri) super(uri) end |