title: Object tree traversal in ruby
body: <p>So... I have the following:</p>
  
  <p>A class with several properties which are retrieved from an .xml file. These properties are if the object is a condition (it has two children) and its name. Basically, the object's children properties are the names of its children.</p>
  
  <p>The .xml looks like this:</p>
  
  <pre><code>&lt;object-2&gt;
       &lt;name&gt;Object - 2&lt;/name&gt;
       &lt;yesChild&gt;Object - 3&lt;/yesChild&gt;
       &lt;noChild&gt;Object - 4&lt;/noChild&gt;
  &lt;/object-2&gt;
  </code></pre>
  
  <p>If the noChild is empty, then it means that the object is not a condition. All objects retrieved from the .xml are stored into an array.</p>
  
  <p>What I need is to somehow create a tree out of it and identify all paths that can be taken in order to reach the last element in the array. The algorithm does not need to traverse all nodes, just the ones it needs to reach the last element of the array.</p>
  
  <p>Example:</p>
  
  <p>We have 4 objects: X1, X2, X3 and X4, where X1 is a condition with X2 and X3 as its children then we will have 2 paths that start in X1 and end in X4.
  Path 1: X1->X2->X4
  Path 2: X1->X3->X4</p>
  
  <p>Thank you.</p>