title: Each loop inside Case for Ruby
body: <p>I'm trying to dynamically generate a case statement based on an array of values. For example let's say I have an array of ranges</p>
  
  <p><code>[1..3,4..6,7..20,21..38]</code></p>
  
  <p>and I want to write a dynamic case statement that returns the first number of whatever range </p>
  
  <pre><code>case n
    ranges.each do |r|
    when r
      r.first
    end
  end
  </code></pre>
  
  <p>Is this possible, or will I have to find another way to do it (my actual code is more complex)?</p>