title: How can I compare classes in Ruby?
body: <p>How can I compare classes in Ruby or in other words how can I translate this Java code into Ruby?</p>
  
  <pre><code>Class&lt;?&gt; clazz = ...;
  if (clazz == String.class) {
    ...
  } else if (clazz == Integer.class) {
    ...
  }
  </code></pre>
  
  <p>To clarify: I do <em>not</em> want to compare object instances or check if an object is an instance of a class.</p>
  
  <p><strong>EDIT:</strong> I do <strong>not</strong> want to compare object instances or check if an object is an instance of a class, i.e. <code>is_a?</code> and <code>kind_of?</code> don't help me.</p>