title: YAML parsing in Ruby: How to get only a certain type of elements?
body: <p>I have the following YAML:</p>
  
  <pre><code>- name: List of monkeys
  - author: Nicolas Raoul
  - version: 2
  - monkey: 
     - name: Chee-Chee
     - age: 2
  - monkey:
     - name: Curious George
     - age: 6
     - food: bananas
  - monkey:
     - name: Mojo
     - food: peanuts
  </code></pre>
  
  <p>In Ruby, how to get the monkeys?<br>
  The number of metadata parameters in the preamble (name, author, ...) is variable.</p>
  
  <p>It would return something like:</p>
  
  <pre><code>[{"monkey"=&gt;[{"name"=&gt;"Chee-Chee"}, {"age"=&gt;2}]}, {"monkey"=&gt;[{"name"=&gt;"Curious George"}, {"age"=&gt;6}, {"food"=&gt;"bananas"}]}, {"monkey"=&gt;[{"name"=&gt;"Mojo"}, {"food"=&gt;"peanuts"}]}]
  </code></pre>
  
  <p>In XML/XPath I would simply write <code>/monkey</code>, but what is the syntax with YAML/Ruby ?</p>
  
  <p><em>Note: I don't want to create a <code>monkeys</code> node containing all monkeys as sub-items, because there are many monkeys and the clients will edit the file to add more, so I want to keep the file really simple. I am new to YAML so a better organization might be needed, but brevity is paramount, in particular I don't want to increase the number of sub-levels.</em></p>