From: Harry Ohlsen Date: 2003-07-10T17:22:47+09:00 Subject: Doing a "case" on class This hits me every time I try to do it and definitely feels non-POLS to me! Can someone explain why this isn't kosher ... fred = 123 case fred.class when Fixnum puts "Yippee!" # when else puts "I don't know what to do with #{fred.class}" end I get "I don't know what to do with Fixnum". I would have thought that fred.class returns a constant instance of Class, namely Fixnum. I would have thought that the explicit "when Fixnum" is comparing it against the same constant instance of Class. Hence, I'd expect it to choose that when clause. What's really going on? If I've just lost the plot (it's happened more than once :-) what's the right way to do this kind of thing? (Obviously, in the real code, the variables I'm do the #class on isn't a constant). Thanks in advance, Harry O.