From: Mike Stok Date: 2006-03-23T11:59:46+09:00 Subject: Re: what on earth.. On 22-Mar-06, at 9:51 PM, Joe Van Dyk wrote: > a = 5 > puts Fixnum == a.class # spits out true > > # spits out "Who knows what I am. :-(" > case a.class > when Fixnum > puts "I'm a fixnum!" > else > puts "Who knows what I am. :-(" > end > > > What's going on here? case doesn't use == you can do this: a = 5 case a when Fixnum puts "I'm a fixnum" else puts "other" end and by coincidence (not) ratdog:~/tmp mike$ irb irb(main):001:0> a = 5 => 5 irb(main):002:0> Fixnum === a => true ratdog:~/tmp mike$ ri Module#=== ------------------------------------------------------------- Module#=== mod === obj => true or false ------------------------------------------------------------------------ Case Equality---Returns +true+ if _anObject_ is an instance of _mod_ or one of _mod_'s descendents. Of limited use for modules, but can be used in +case+ statements to classify objects by class. Hope this helps, Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply.