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?
classofxis aString. Well, obviously, it isn't, it's aClass. In the second example, you are asking whetherxis aString, and that's the case.