title: Why are my when conditions not being met if string contains substring?
body: <p>I'm having trouble figuring out why my <code>when</code> conditions aren't being met. Each should return true when <code>move</code> contains <code>"n"</code>, <code>"s"</code>, <code>"e"</code>, or <code>"w"</code> respectively. Here is a simplified version of my code:</p>
  
  <pre><code>loc = {x: 0, y: 0}
  
  move = gets.chomp
  case move
  when move.match?(/n/); loc[:y] += move.gsub(/[a-z]/, '').to_i
  when move.match?(/s/); loc[:y] -= move.gsub(/[a-z]/, '').to_i
  when move.match?(/e/); loc[:x] += move.gsub(/[a-z]/, '').to_i
  when move.match?(/w/); loc[:x] -= move.gsub(/[a-z]/, '').to_i
  else; puts "Input '#{move}' not recognized!"
  end
  </code></pre>
  
  <p>I've also tried using <code>move.include?('n')</code>, etc. with no success.</p>