title: Ruby `when' keyword does not use == in case statement. What does it use?
body: <p><code>x == User</code> returns <code>true</code>, but <code>case x</code> statement does not run the block associated with <code>User</code>. What's happening here?</p>
  
  <pre><code>u = User.new
  # =&gt; #&lt;User:0x00000100a1e948&gt;
  
  x = u.class
  # =&gt; User
  
  x == User
  # =&gt; true
  
  case x
  when User
    puts "constant"
  when "User"
    puts "string"
  else
    puts "nothing?"
  end
  # =&gt; nothing?
  </code></pre>