title: Selecting hash elements by comparing with array
body: <p>I am looking for the Ruby/Rails way to approach the classic "select items from a set based on matches with another set" task.</p>
  
  <p>Set one is a simple hash, like this: </p>
  
  <pre><code>  fruits = {:apples =&gt; "red", :oranges =&gt; "orange", :mangoes =&gt; "yellow", :limes =&gt; "green"}
  </code></pre>
  
  <p>Set two is an array, like this:</p>
  
  <pre><code>   breakfast_fruits = [:apples, :oranges]
  </code></pre>
  
  <p>The desired outcome is a hash containing the fruits that are listed in Breakfast_fruits:</p>
  
  <pre><code>    menu = {:apples =&gt; "red", :oranges =&gt; "orange"}
  </code></pre>
  
  <p>I've got a basic nested loop going, but am stuck on basic comparison syntax:</p>
  
  <pre><code>   menu = {}
  
     breakfast_fruits.each do |brekky|
        fruits.each do |fruit|
           //if fruit has the same key as brekky put it in menu
        end
     end
  </code></pre>
  
  <p>I'd also love to know if there is a better way to do this in Ruby than nested iterators.</p>