title: Recursion with nested array with hashes
body: <p>I'm not getting this to work correctly.</p>
  
  <p>I have an array of hashes with a nested arrays of hashes of varying depth. If any of the nested results are false it must return false otherwise true.</p>
  
  <pre><code>array = [
    {
      result: true,
      dependents: [
        {
          result: true,
          dependents: [
            {result: true},
            {result: false}
          ]
        }
      ]
    },
    result: true,
    dependents: []
  ]
  
  def result(array)
     if array.find {|line| line[:result] == false}
      return false
     else
      array.each do |line| 
        result(line[:dependents])
      end
    end
    true    
  end
  
  result(array)
  #=&gt; true (should be false)
  </code></pre>
  
  <p>The method <code>result()</code> is not working correctly at the moment as it is returning true for the given array and should be false. Any ideas?</p>