uri-ni 0.2.1 → 0.2.2
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
- data/lib/uri/ni/version.rb +1 -1
- data/lib/uri/ni.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0210a945c627b9ec4a14f96b5beac95ca2084e5a873643ed963d37f939f81796
|
|
4
|
+
data.tar.gz: d3c7a53b7c0dfb92e64e2989114863838dbf2b895a9fb0a4375f86213fd61d7d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e02348cfcdb25c10a8ff83c462bfff0c3720b1488bedc33a3e8735eb1a98f3887afd50ca5d6f6674f30fd2ae92e3f5bf49822dbcc2ee6c1ee51385e55612ea36
|
|
7
|
+
data.tar.gz: 4f6a9d14efab6c9b6fa46c9df390d5222ef8a8a6afe4d06aeba6709284d59f20d35aa12d5da4f8f3dc52cb2a159dd17f97872165278324b0407b20f8e4280bd7
|
data/lib/uri/ni/version.rb
CHANGED
data/lib/uri/ni.rb
CHANGED
|
@@ -58,7 +58,9 @@ class URI::NI < URI::Generic
|
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
[k, v]
|
|
61
|
-
end.to_h
|
|
61
|
+
end.to_h.freeze
|
|
62
|
+
|
|
63
|
+
TRUNCATED = [32, 64, 96, 120, 128].map { |i| "sha-256-#{i}".to_sym }.freeze
|
|
62
64
|
|
|
63
65
|
# resolve first against digest length and then class
|
|
64
66
|
DIGEST_REV = {
|
|
@@ -324,6 +326,14 @@ class URI::NI < URI::Generic
|
|
|
324
326
|
LENGTHS[algorithm] and LENGTHS[algorithm] == digest.length
|
|
325
327
|
end
|
|
326
328
|
|
|
329
|
+
# Returns true if the algorithm is a truncated one.
|
|
330
|
+
#
|
|
331
|
+
# @return [false, true]
|
|
332
|
+
#
|
|
333
|
+
def truncated?
|
|
334
|
+
TRUNCATED.include? algorithm
|
|
335
|
+
end
|
|
336
|
+
|
|
327
337
|
# Display the available algorithms.
|
|
328
338
|
#
|
|
329
339
|
# @return [Array] containing the symbols representing the available
|