In general it is possible to compare two classes like this
x = "String"
puts "A string" if x.class == String
But, when case
is used like this,
x = "String"
case x.class
when String
puts "A string"
end
It doesn't work. Why?
Update:
In the following case,
x = "String"
case x
when String
puts "A string"
end
it works. Does it mean, case
converts classes into strings implicitly?