title: Ruby: Yielding from a method that takes arguments?
body: <p>I've written a very simple, recursive, tree-traversal method in ruby. I want to yield the results of this traversal so that I can easily iterate through the nodes of the tree. </p>
  
  <pre><code>def bottom_up_traversal (node)
      if(node.has_leaf_children?)
          node.children.each{|i| yield i} 
      else
          node.children.each{|i| bottom_up_traversal(i)}
          yield node
      end
  
  end
  </code></pre>
  
  <p>And when I attempt to call it, like:</p>
  
  <pre><code> bottom_up_traversal(@root){|this_node| puts this_node }
  </code></pre>
  
  <p>I get a 'Wrong number of arguments (0 for 1)'. I know this is probably just something silly i'm doing with syntax, but I cannot find any (even basic) examples of this being done....which leads me to believe that I'm misunderstanding how I should be using code-bocks (something which is admittedly new to me)  </p>
  
  <p>So, could you perhaps tell me how I'm supposed to call this method, or where I've gone wrong? </p>