vrt 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fd5c389eb5bd383a61325e88b698ee26e37e2d8
4
- data.tar.gz: 7beea5136f462db2243da8063c7c30db955f703f
3
+ metadata.gz: 4a5df68aeb02a33a02331c169ecbc8461d09bbaf
4
+ data.tar.gz: daf91c2b754a14d2879d57c4dc7a54c04d98f721
5
5
  SHA512:
6
- metadata.gz: 208b805887df9f33a4741ec86c296e8c339012afd24c79c612fc9be16243256ba0296ce9d9bfcc70d15c64737adb7dc95e5349426521e7e66812eb2448c651ca
7
- data.tar.gz: 91cb49c9d188adee9ea1385cb1ecb0e7b7e5e9ad781f85139d227a9536f7e08b63358cdfbddabcf0476d1b7bea79fd00229da8d5e8584f3946401cb8d93fbfaf
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 [String] (Optional - recommended) A valid vrt_version that the vrt_id exists in
69
- # @param [string] (Optional) The preferred new vrt_version to find a match in
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:, version: nil, preferred_version: nil, max_depth: 'variant')
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
- return nil unless version
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, old_version, new_version, max_depth)
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
- return nil if old_node.parent.nil?
41
- find_valid_parent_node(old_node.parent.qualified_vrt_id, old_version, new_version, max_depth)
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
@@ -1,3 +1,3 @@
1
1
  module Vrt
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vrt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barnett Klane