protocol-url 0.11.0 → 0.12.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/absolute.rb +11 -11
- data/lib/protocol/url/reference.rb +2 -2
- data/lib/protocol/url/relative.rb +16 -9
- data/lib/protocol/url/version.rb +1 -1
- data/readme.md +49 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -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: 67f58bb48277d53b3817bb38b2b7c4546a8a8e1f3df62cea531c577705c4c833
|
|
4
|
+
data.tar.gz: 55bcfd924be9ae1eada0b2e5f8ee93fcd4a1a24c0693986ed3f8818b26072fd1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7df97ce90f4ce934023217fbedf9cbf864febeee311b9b25e3ee952e647d75d8cc041f16665b84884fec1e1d2dad859f9f3d21a0bfdccf40f832938158a21924
|
|
7
|
+
data.tar.gz: bb2c1f9fece1eda9cb5ee8b96d216b28e0e15c6fe9605c6ec0d43a615b5b9a247f9bc299553e1d46778d9e6c5971e34d56bbd77f172202002ad63d7be89b53c3
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -15,8 +15,8 @@ module Protocol
|
|
|
15
15
|
# @parameter scheme [String] The URL scheme (e.g., "https", "http").
|
|
16
16
|
# @parameter authority [String] The authority component (e.g., "example.com", "user@host:port").
|
|
17
17
|
# @parameter path [String | Path] The encoded path component (defaults to "/").
|
|
18
|
-
# @parameter query [String
|
|
19
|
-
# @parameter fragment [String
|
|
18
|
+
# @parameter query [String | Nil] The query string.
|
|
19
|
+
# @parameter fragment [String | Nil] The fragment identifier.
|
|
20
20
|
def initialize(scheme, authority, path = "/", query = nil, fragment = nil)
|
|
21
21
|
@scheme = scheme
|
|
22
22
|
@authority = authority
|
|
@@ -36,11 +36,11 @@ module Protocol
|
|
|
36
36
|
return super
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
# @attribute [String] The URL scheme.
|
|
40
|
-
|
|
39
|
+
# @attribute [String | Nil] The URL scheme.
|
|
40
|
+
attr_accessor :scheme
|
|
41
41
|
|
|
42
|
-
# @attribute [String] The authority component.
|
|
43
|
-
|
|
42
|
+
# @attribute [String | Nil] The authority component.
|
|
43
|
+
attr_accessor :authority
|
|
44
44
|
|
|
45
45
|
# Check if the URL has a non-empty scheme.
|
|
46
46
|
#
|
|
@@ -122,11 +122,11 @@ module Protocol
|
|
|
122
122
|
|
|
123
123
|
# Create a new Absolute URL with modified components.
|
|
124
124
|
#
|
|
125
|
-
# @parameter scheme [String
|
|
126
|
-
# @parameter authority [String
|
|
127
|
-
# @parameter path [String
|
|
128
|
-
# @parameter query [String
|
|
129
|
-
# @parameter fragment [String
|
|
125
|
+
# @parameter scheme [String | Nil] The scheme to use (nil to remove scheme).
|
|
126
|
+
# @parameter authority [String | Nil] The authority to use (nil to remove authority).
|
|
127
|
+
# @parameter path [String | Nil] The path to merge with the current path.
|
|
128
|
+
# @parameter query [String | Nil] The query string to use.
|
|
129
|
+
# @parameter fragment [String | Nil] The fragment to use.
|
|
130
130
|
# @parameter pop [Boolean] Whether to pop the last path component before merging.
|
|
131
131
|
# @returns [Absolute] A new Absolute URL with the modified components.
|
|
132
132
|
#
|
|
@@ -102,8 +102,8 @@ module Protocol
|
|
|
102
102
|
@parameters = parameters
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
# @attribute [Hash] User supplied parameters that will be appended to the query part.
|
|
106
|
-
|
|
105
|
+
# @attribute [Hash | Nil] User supplied parameters that will be appended to the query part.
|
|
106
|
+
attr_accessor :parameters
|
|
107
107
|
|
|
108
108
|
# Freeze the reference.
|
|
109
109
|
#
|
|
@@ -15,8 +15,8 @@ module Protocol
|
|
|
15
15
|
# Initialize a new relative URL.
|
|
16
16
|
#
|
|
17
17
|
# @parameter path [String | Path] The encoded path component.
|
|
18
|
-
# @parameter query [String
|
|
19
|
-
# @parameter fragment [String
|
|
18
|
+
# @parameter query [String | Nil] The query string.
|
|
19
|
+
# @parameter fragment [String | Nil] The fragment identifier.
|
|
20
20
|
def initialize(path, query = nil, fragment = nil)
|
|
21
21
|
@path = Path[path]
|
|
22
22
|
@query = query
|
|
@@ -38,11 +38,18 @@ module Protocol
|
|
|
38
38
|
# @attribute [Path] The path component of the URL.
|
|
39
39
|
attr :path
|
|
40
40
|
|
|
41
|
-
#
|
|
42
|
-
|
|
41
|
+
# Replace the path component of this URL.
|
|
42
|
+
# @parameter path [String | Path] The encoded path component.
|
|
43
|
+
# @returns [Path] The assigned path component.
|
|
44
|
+
def path=(path)
|
|
45
|
+
@path = Path[path]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @attribute [String | Nil] The query string component.
|
|
49
|
+
attr_accessor :query
|
|
43
50
|
|
|
44
|
-
# @attribute [String
|
|
45
|
-
|
|
51
|
+
# @attribute [String | Nil] The fragment identifier.
|
|
52
|
+
attr_accessor :fragment
|
|
46
53
|
|
|
47
54
|
# Resolve the URL path beneath a local filesystem root.
|
|
48
55
|
#
|
|
@@ -104,9 +111,9 @@ module Protocol
|
|
|
104
111
|
|
|
105
112
|
# Create a new Relative URL with modified components.
|
|
106
113
|
#
|
|
107
|
-
# @parameter path [String
|
|
108
|
-
# @parameter query [String
|
|
109
|
-
# @parameter fragment [String
|
|
114
|
+
# @parameter path [String | Nil] The path to merge with the current path.
|
|
115
|
+
# @parameter query [String | Nil] The query string to use.
|
|
116
|
+
# @parameter fragment [String | Nil] The fragment to use.
|
|
110
117
|
# @parameter pop [Boolean] Whether to pop the last path component before merging.
|
|
111
118
|
# @returns [Relative] A new Relative URL with the modified components.
|
|
112
119
|
#
|
data/lib/protocol/url/version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -34,6 +34,55 @@ bundle exec sus
|
|
|
34
34
|
|
|
35
35
|
Please see the [project releases](https://socketry.github.io/protocol-url/releases/index) for all releases.
|
|
36
36
|
|
|
37
|
+
### v0.12.0
|
|
38
|
+
|
|
39
|
+
- Allow unfrozen relative and absolute URLs to replace their components.
|
|
40
|
+
|
|
41
|
+
### v0.10.0
|
|
42
|
+
|
|
43
|
+
- Rename `Protocol::URL::FormData::Parser::CONTENT_TYPE` to `MEDIA_TYPE`.
|
|
44
|
+
|
|
45
|
+
### v0.9.0
|
|
46
|
+
|
|
47
|
+
- Add `Protocol::URL::LimitError` for configured processing limits.
|
|
48
|
+
|
|
49
|
+
### v0.8.0
|
|
50
|
+
|
|
51
|
+
- Use consistent limit naming for form data parser constraints.
|
|
52
|
+
|
|
53
|
+
### v0.7.0
|
|
54
|
+
|
|
55
|
+
- Allow `Protocol::URL::FormData::Parser#parse` to populate a supplied result object.
|
|
56
|
+
|
|
57
|
+
### v0.6.0
|
|
58
|
+
|
|
59
|
+
- Add `Protocol::URL::FormData::Parser` for incremental, limited parsing of `application/x-www-form-urlencoded` form data.
|
|
60
|
+
- Add `Protocol::URL::FormData::Nested` for consistently building nested form data while preserving absent and empty values.
|
|
61
|
+
|
|
62
|
+
### v0.5.0
|
|
63
|
+
|
|
64
|
+
- Add `Protocol::URL::Encoding.decode_www_form` for decoding HTML form data where `+` represents a space.
|
|
65
|
+
|
|
66
|
+
### v0.4.0
|
|
67
|
+
|
|
68
|
+
- Add comparison methods to `Protocol::URL::Relative` (and by inheritance to `Protocol::URL::Absolute`):
|
|
69
|
+
- `#==` for structural equality comparison (compares path, query, fragment components).
|
|
70
|
+
- `#===` for string equality comparison (enables case statement matching).
|
|
71
|
+
- `#<=>` for ordering and sorting.
|
|
72
|
+
- `#hash` for hash key support.
|
|
73
|
+
- `#equal?` for component-based equality checking.
|
|
74
|
+
- Add JSON serialization support to `Protocol::URL::Relative`:
|
|
75
|
+
- `#as_json` returns the string representation.
|
|
76
|
+
- `#to_json` returns a JSON-encoded string.
|
|
77
|
+
|
|
78
|
+
### v0.3.0
|
|
79
|
+
|
|
80
|
+
- Add `relative(target, from)` for computing relative paths between URLs.
|
|
81
|
+
|
|
82
|
+
### v0.2.0
|
|
83
|
+
|
|
84
|
+
- Move `Protocol::URL::PATTERN` to `protocol/url/pattern.rb` so it can be shared more easily.
|
|
85
|
+
|
|
37
86
|
### v0.10.0
|
|
38
87
|
|
|
39
88
|
- Rename `Protocol::URL::FormData::Parser::CONTENT_TYPE` to `MEDIA_TYPE`.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|