vrt 0.3.1 → 0.3.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/vrt.rb +7 -7
- data/lib/vrt/cross_version_mapping.rb +4 -4
- data/lib/vrt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a5df68aeb02a33a02331c169ecbc8461d09bbaf
|
|
4
|
+
data.tar.gz: daf91c2b754a14d2879d57c4dc7a54c04d98f721
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 62c43be4caa4cd6e8a43116926a10cc4a10bfcfdb6b5966215b9a89422513ce01521eb2b46bd3a434c7866b26a27763a96389dae7d99b696f1af467a1b343e35
|
|
7
|
+
data.tar.gz: 71bbd9014ec9b5151715726cfe0944f8ea0b4a9f76875e787b956f36325f2ef4f3d36c0a53cf90f8391b31fcccae2354862c245e065d4a612f0dbc5bbd0ac726
|
data/lib/vrt.rb
CHANGED
|
@@ -64,20 +64,20 @@ module VRT
|
|
|
64
64
|
# the appropriate deprecated mapping. If neither is found it will walk up the tree to find a
|
|
65
65
|
# valid parent node before giving up and returning nil.
|
|
66
66
|
#
|
|
67
|
-
# @param [String] A valid vrt_id
|
|
68
|
-
# @param [
|
|
69
|
-
#
|
|
70
|
-
# @param [String] (Optional) The maximum depth to match in
|
|
67
|
+
# @param [String] vrt_id A valid vrt_id
|
|
68
|
+
# @param [string] preferred_version (Optional) The preferred vrt_version of the returned node
|
|
69
|
+
# (defaults to current_version)
|
|
70
|
+
# @param [String] max_depth (Optional) The maximum depth to match in
|
|
71
|
+
# @param [String] version (deprecated) This parameter is no longer used
|
|
71
72
|
# @return [VRT::Node|Nil] A valid VRT::Node object or nil if no best match could be found
|
|
72
|
-
def find_node(vrt_id:,
|
|
73
|
+
def find_node(vrt_id:, preferred_version: nil, max_depth: 'variant', version: nil) # rubocop:disable Lint/UnusedMethodArgument
|
|
73
74
|
new_version = preferred_version || current_version
|
|
74
75
|
if Map.new(new_version).valid?(vrt_id)
|
|
75
76
|
Map.new(new_version).find_node(vrt_id, max_depth: max_depth)
|
|
76
77
|
elsif deprecated_node?(vrt_id)
|
|
77
78
|
find_deprecated_node(vrt_id, preferred_version, max_depth)
|
|
78
79
|
else
|
|
79
|
-
|
|
80
|
-
find_valid_parent_node(vrt_id, version, new_version, max_depth)
|
|
80
|
+
find_valid_parent_node(vrt_id, new_version, max_depth)
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
|
|
@@ -31,14 +31,14 @@ module VRT
|
|
|
31
31
|
VRT::Map.new(new_version).find_node(node_id, max_depth: max_depth)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def find_valid_parent_node(vrt_id,
|
|
35
|
-
old_node = VRT::Map.new(old_version).find_node(vrt_id)
|
|
34
|
+
def find_valid_parent_node(vrt_id, new_version, max_depth)
|
|
36
35
|
new_map = VRT::Map.new(new_version)
|
|
37
36
|
if new_map.valid?(vrt_id)
|
|
38
37
|
new_map.find_node(vrt_id, max_depth: max_depth)
|
|
39
38
|
else
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
parent = vrt_id.split('.')[0..-2].join('.')
|
|
40
|
+
return nil if parent.empty?
|
|
41
|
+
find_valid_parent_node(parent, new_version, max_depth)
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|
data/lib/vrt/version.rb
CHANGED