From: Austin Ziegler Date: 2004-07-29T22:14:56+09:00 Subject: Re: [Q] class and case On Thu, 29 Jul 2004 22:01:53 +0900, E.-R. Bruecklmeier wrote: > Hi, > > a = 3 > > #A > case a > when Fixnum > p "Fixnum" > end > > #B > case a.class > when Fixnum > p "Fixnum" > end > > why ist #A working while #B isn't? % 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. Thus: case a.class when Fixnum p "Fixnum" # => Never Reached when Class p "Class!" # => or Object, or Module, or several others, see a.class.ancestors end -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca