In order to get the behavior you want, you could try this:

case obj.class.id
when String.id
  'is a String'
when Integer.id
  'is an Integer'
else
  'is something else'
end


Chris