protocol-url 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/url/pattern.rb +21 -0
- data/lib/protocol/url/reference.rb +1 -0
- data/lib/protocol/url/version.rb +1 -1
- data/lib/protocol/url.rb +1 -14
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +2 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: efcdbe6f1de1ec7c6bdadf70824bdd62e0b351c768896e52c34234e982a3527d
|
|
4
|
+
data.tar.gz: 3687c0ff3fe5723b3df989d929326062120307e199b801395faf7026dd49606b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb62cd371a93e7fadf9b51823382d06034365301470336733c3870798c29839a5c8d550706dc1e69fb5de964d442192299f1f8fdd351df836b8852bc0e730fd9
|
|
7
|
+
data.tar.gz: e4bee5e0cf8ee2aac01942418e0045cd233b0a901535891933bc274eff4bb9c0fff9edb2164eedbd99dda633a68fd91ce45dc823dabb5f5516d5818752301587
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2025, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
module Protocol
|
|
7
|
+
module URL
|
|
8
|
+
# RFC 3986 URI pattern with named capture groups.
|
|
9
|
+
# Matches: [scheme:][//authority][path][?query][#fragment]
|
|
10
|
+
# Rejects strings containing whitespace or control characters (matching standard URI behavior).
|
|
11
|
+
PATTERN = %r{
|
|
12
|
+
\A
|
|
13
|
+
(?:(?<scheme>[a-z][a-z0-9+.-]*):)? # scheme (optional)
|
|
14
|
+
(?://(?<authority>[^/?#\s]*))? # authority (optional, without //, no whitespace)
|
|
15
|
+
(?<path>[^?#\s]*) # path (no whitespace)
|
|
16
|
+
(?:\?(?<query>[^#\s]*))? # query (optional, no whitespace)
|
|
17
|
+
(?:\#(?<fragment>[^\s]*))? # fragment (optional, no whitespace)
|
|
18
|
+
\z
|
|
19
|
+
}ix
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/protocol/url/version.rb
CHANGED
data/lib/protocol/url.rb
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
# Copyright, 2025, by Samuel Williams.
|
|
5
5
|
|
|
6
6
|
require_relative "url/version"
|
|
7
|
+
require_relative "url/pattern"
|
|
7
8
|
require_relative "url/encoding"
|
|
8
9
|
require_relative "url/reference"
|
|
9
10
|
require_relative "url/relative"
|
|
@@ -11,20 +12,6 @@ require_relative "url/absolute"
|
|
|
11
12
|
|
|
12
13
|
module Protocol
|
|
13
14
|
module URL
|
|
14
|
-
# RFC 3986 URI pattern with named capture groups.
|
|
15
|
-
# Matches: [scheme:][//authority][path][?query][#fragment]
|
|
16
|
-
# Rejects strings containing whitespace or control characters (matching standard URI behavior).
|
|
17
|
-
PATTERN = %r{
|
|
18
|
-
\A
|
|
19
|
-
(?:(?<scheme>[a-z][a-z0-9+.-]*):)? # scheme (optional)
|
|
20
|
-
(?://(?<authority>[^/?#\s]*))? # authority (optional, without //, no whitespace)
|
|
21
|
-
(?<path>[^?#\s]*) # path (no whitespace)
|
|
22
|
-
(?:\?(?<query>[^#\s]*))? # query (optional, no whitespace)
|
|
23
|
-
(?:\#(?<fragment>[^\s]*))? # fragment (optional, no whitespace)
|
|
24
|
-
\z
|
|
25
|
-
}ix
|
|
26
|
-
private_constant :PATTERN
|
|
27
|
-
|
|
28
15
|
# Coerce a value into an appropriate URL type (Absolute or Relative).
|
|
29
16
|
#
|
|
30
17
|
# @parameter value [String, Absolute, Relative, nil] The value to coerce.
|
data/readme.md
CHANGED
|
@@ -34,6 +34,10 @@ This project is best served by a collaborative and respectful environment. Treat
|
|
|
34
34
|
|
|
35
35
|
Please see the [project releases](https://github.com/socketry/protocol-urlreleases/index) for all releases.
|
|
36
36
|
|
|
37
|
+
### v0.2.0
|
|
38
|
+
|
|
39
|
+
- Move `Protocol::URL::PATTERN` to `protocol/url/pattern.rb` so it can be shared more easily.
|
|
40
|
+
|
|
37
41
|
### v0.1.0
|
|
38
42
|
|
|
39
43
|
- Initial implementation.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: protocol-url
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -46,6 +46,7 @@ files:
|
|
|
46
46
|
- lib/protocol/url/absolute.rb
|
|
47
47
|
- lib/protocol/url/encoding.rb
|
|
48
48
|
- lib/protocol/url/path.rb
|
|
49
|
+
- lib/protocol/url/pattern.rb
|
|
49
50
|
- lib/protocol/url/reference.rb
|
|
50
51
|
- lib/protocol/url/relative.rb
|
|
51
52
|
- lib/protocol/url/version.rb
|
metadata.gz.sig
CHANGED
|
Binary file
|