title: How do I write a conditional Ruby case statement with parameters passed into the case?
body: <p>I'm trying to figure out a way for a <code>case</code> statement to take into account two parameters passed in from a regex. </p>
  
  <p>My regex example is:</p>
  
  <p>When <code>(/^(?:a|an|the) (RoleA|RoleB)</code> attempts to access a <code>(New|Updated) Record$/)</code> do <code>|role_type, record_type|</code>.</p>
  
  <p>I have a <code>case</code> statement that only accounts for role type right now, but how do I also have the case portion account for <code>role_type</code> and <code>record_type</code>?</p>
  
  <p>My goal is to test that Role A is directed to a different set of endpoints when the record type is "New" or "Updated" and I want Role B to be directed to another set of endpoints when passing in "New" and "Updated". If they were being passed into the same endpoints, then a case statement for <code>record_type</code> only would suffice.</p>
  
  <p>What I have right now is:</p>
  
  <pre><code>case record_type
     when 'New'
       &lt;do something&gt;
     when 'Updated'
       &lt;do something&gt;
   end
  </code></pre>
  
  <p>I'd like to  switch the behavior based on what the role is. This  didn't work:</p>
  
  <pre><code>case record_type &amp;&amp; role_type == 'RoleA'
     when 'New'
       &lt;do something&gt;
     when 'Updated'
       &lt;do something&gt;
   end
  
  case record_type &amp;&amp; role_type == 'RoleB'
     when 'New'
       &lt;do something&gt;
     when 'Updated'
       &lt;do something&gt;
   end
  </code></pre>
  
  <p>This code is skipped over and I'm assuming that Ruby is confused about which statement to use.</p>