Method: Jinx::Visitor#visit_recursive

Defined in:
lib/jinx/helpers/visitor.rb

#visit_recursive(node, &operator) ⇒ Object (private)



254
255
256
257
258
259
260
261
262
263
264
# File 'lib/jinx/helpers/visitor.rb', line 254

def visit_recursive(node, &operator)
  # Bail if no node or the node is specifically excluded.
  return if node.nil? or @exclude.include?(node)
  # Return the visited value if the node has already been visited.
  return @visited[node] if @visited.has_key?(node)
  # Return nil if the node has not been visited but has been navigated in a
  # depth-first visit.
  return if @lineage.include?(node)
  # All systems go: visit the node subgraph.
  visit_node_and_children(node, &operator)
end