title: Ruby: Compare 2 arrays for matches, and count the number of match instances
body: <p>I have 2 arrays:</p>
  
  <pre><code>@array1 = [a,b,c,d,e]
  @array2 = [d,e,f,g,h]
  </code></pre>
  
  <p>I want to compare the two arrays to find matches (d,e) and count the number of matches found (2)?</p>
  
  <pre><code>&lt;% if @array2.include?(@array1) %&gt;
    # yes, but how to count instances?
  &lt;% else %&gt;
    no matches found...
  &lt;% end %&gt;
  </code></pre>
  
  <p>Thanks in advance~</p>