title: find_all elements in an array that match a condition?
body: <p>I've an array of hash entries, and want to filter based on a paramater passed into the function.</p>
  
  <p>If there are three values in the hash, <code>A</code>, <code>B</code>, and <code>C</code>, I want to do something similar to:</p>
  
  <pre><code>data = [{A:'a1', B:'b1', C:'c1'}, 
      {A:'a1', B:'b2', C:'c1'},
      {A:'a1', B:'b2', C:'c2'}, 
      {A:'a2', B:'b1', C:'c1'},
      {A:'a2', B:'b2', C:'c1'}]
  
  data.find_all{ |d| d[:A].include?params[:A] }
      .find_all{ |d| d[:B].include?params[:B] }
      .find_all{ |d| d[:C].include?params[:C] }
  </code></pre>
  
  <p>find all where A == 'a1' AND B='b2'</p>
  
  <p>so for above I get:
  {A:'a1', B:'b2', C:'c1'} and {A:'a1', B:'b2', C:'c2'} 
  * put <code>if</code> / <code>else</code> statements, like <code>params.has_key? 'B'</code> then do something.
  * modify my code each time a new type of value is added to the Hash map (say now I have 'D').</p>
  
  <p>Note: The key of the hash is a symbol, but the value is a string and I want to do a "contains" not "equals".</p>
  
  <p>I think of it as SQL Select statement with where zero or more '==' clause</p>