protocol-url 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12a81d3a05c932207c77a583df784431d7120f3f1f9ee68c9ea593a47c666831
4
- data.tar.gz: 3307c15e0d16d4907259cd186c0483d46d78358e0b1bfee99e3cf3186a1c74d2
3
+ metadata.gz: ff6accb882e5c993ee454290f6d282d67df6b4d13ee01bdd24b042ea764ee03c
4
+ data.tar.gz: abc0495ee011bccd902d3f60bebcf4d8231e3559b14305fe5594d62df285eeae
5
5
  SHA512:
6
- metadata.gz: 8e948fff9470b6676b5b28638af7fdc64eaa31e3565c980071a539eadbf3651b8c10037ed1bcec70b43360a30fbb595f14bf965898e6ab4f1b4e8baf1e942491
7
- data.tar.gz: 86de1d30699c4c3f7c85878ca3c0edf45da61991593d4600bfc83be2b667525ccc8bb01ea5a51ddf82248045933b49a3ef8879947100a5ac88d67d94a2947786
6
+ metadata.gz: 1a1852872d62c65b0d78f8cd698deaaca69ceea65b79fb2e9d04b0b1b347cf6555ba41c27b0c836e2b963981f0c9be9a8feeec55622cdede7018a01321d7bca6
7
+ data.tar.gz: 4c6a01694dda0e059d944e5155f365c27c00c244e8e5ea7310288b875f2f307e4ef0c610dd8ea906e30fd5338d13f33fb1d2b83dcd5c076d57e34a60eb515b3b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -95,14 +95,6 @@ module Protocol
95
95
  [@path, @query, @fragment, @parameters]
96
96
  end
97
97
 
98
- # Compare two references.
99
- #
100
- # @parameter other [Reference] The other reference to compare.
101
- # @returns [Integer] -1, 0, 1 if the reference is less than, equal to, or greater than the other reference.
102
- def <=> other
103
- to_ary <=> other.to_ary
104
- end
105
-
106
98
  # @returns [Boolean] Whether the reference has parameters.
107
99
  def parameters?
108
100
  @parameters and !@parameters.empty?
@@ -135,14 +135,38 @@ module Protocol
135
135
  [@path, @query, @fragment]
136
136
  end
137
137
 
138
+ def hash
139
+ to_ary.hash
140
+ end
141
+
142
+ def equal?(other)
143
+ to_ary == other.to_ary
144
+ end
145
+
138
146
  def <=>(other)
139
147
  to_ary <=> other.to_ary
140
148
  end
141
149
 
150
+ def ==(other)
151
+ to_ary == other.to_ary
152
+ end
153
+
154
+ def ===(other)
155
+ to_s === other
156
+ end
157
+
142
158
  def to_s
143
159
  append
144
160
  end
145
161
 
162
+ def as_json(...)
163
+ to_s
164
+ end
165
+
166
+ def to_json(...)
167
+ as_json.to_json(...)
168
+ end
169
+
146
170
  def inspect
147
171
  "#<#{self.class} #{to_s}>"
148
172
  end
@@ -7,6 +7,6 @@
7
7
  module Protocol
8
8
  # @namespace
9
9
  module URL
10
- VERSION = "0.3.0"
10
+ VERSION = "0.4.0"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -34,6 +34,18 @@ 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.4.0
38
+
39
+ - Add comparison methods to `Protocol::URL::Relative` (and by inheritance to `Protocol::URL::Absolute`):
40
+ - `#==` for structural equality comparison (compares path, query, fragment components).
41
+ - `#===` for string equality comparison (enables case statement matching).
42
+ - `#<=>` for ordering and sorting.
43
+ - `#hash` for hash key support.
44
+ - `#equal?` for component-based equality checking.
45
+ - Add JSON serialization support to `Protocol::URL::Relative`:
46
+ - `#as_json` returns the string representation.
47
+ - `#to_json` returns a JSON-encoded string.
48
+
37
49
  ### v0.3.0
38
50
 
39
51
  - Add `relative(target, from)` for computing relative paths between URLs.
data/releases.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Releases
2
2
 
3
+ ## v0.4.0
4
+
5
+ - Add comparison methods to `Protocol::URL::Relative` (and by inheritance to `Protocol::URL::Absolute`):
6
+ - `#==` for structural equality comparison (compares path, query, fragment components).
7
+ - `#===` for string equality comparison (enables case statement matching).
8
+ - `#<=>` for ordering and sorting.
9
+ - `#hash` for hash key support.
10
+ - `#equal?` for component-based equality checking.
11
+ - Add JSON serialization support to `Protocol::URL::Relative`:
12
+ - `#as_json` returns the string representation.
13
+ - `#to_json` returns a JSON-encoded string.
14
+
3
15
  ## v0.3.0
4
16
 
5
17
  - Add `relative(target, from)` for computing relative paths between URLs.
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file