From: Gavin Kistner Date: 2004-02-20T20:22:23+09:00 Subject: Re: Can't case on class? Kent S. wrote: > Gavin Kistner wrote: >> 3 puts "Class is #{@optionSet.class}." >> 4 puts "Is it OK? #{@optionSet.class==ValidForm::OptionSet}" >> 5 puts "What about this: #{@optionSet==ValidForm::OptionSet}" >> 6 case @optionSet.class > mod === obj => true or false Bah, I forgot that case used === and not ==. Thanks, Kent. So the questions I have now are: a) Why does someClass===someClass return false? b) Why does the case fooInstance; when FooClass; work? I ask the second because: irb(main):001:0> foo = %w{ a b c d } => ["a", "b", "c", "d"] irb(main):002:0> foo.class => Array irb(main):003:0> foo.class==Array => true irb(main):004:0> foo.class===Array => false irb(main):005:0> foo==Array => false irb(main):006:0> foo===Array => false Line 4 confirms what Kent pointed out...but line 6 seems to indicate that the case statement switching off of the instance itself (which does work) should not work. -- (-, /\ \/ / /\/