Method: VRT.find_node
- Defined in:
- lib/vrt.rb
.find_node(vrt_id:, version: nil, preferred_version: nil, max_depth: 'variant') ⇒ VRT::Node|Nil
Finds the best match valid node. First looks at valid nodes in the given new version or finds the appropriate deprecated mapping. If neither is found it will walk up the tree to find a valid parent node before giving up and returning nil.
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/vrt.rb', line 72 def find_node(vrt_id:, version: nil, preferred_version: nil, max_depth: 'variant') new_version = preferred_version || current_version if Map.new(new_version).valid?(vrt_id) Map.new(new_version).find_node(vrt_id, max_depth: max_depth) elsif deprecated_node?(vrt_id) find_deprecated_node(vrt_id, preferred_version, max_depth) else return nil unless version find_valid_parent_node(vrt_id, version, new_version, max_depth) end end |