From: Stefan Schmiedl Date: 2001-12-11T17:27:50+09:00 Subject: [ruby-talk:28186] Re: The benefits of dynamic typing? Alexander Schofield (2001-12-11 16:17): > Harry Ohlsen wrote: > > > > In article <20011211.105127.461152493.1860@zip.com.au>, "Harry Ohlsen" > > wrote: > > > Actually, this makes me wonder ... is there a method somewhere that lets me find out whether a given object's class is a descendent of a given class? If not, one could definitely write such a thing, by running up the superclass hierarchy. > > Do you mean Object#kind_of? > > irb(main):017:0> 2.kind_of? Numeric > true > irb(main):018:0> 2.kind_of? Integer > true > irb(main):019:0> 2.kind_of? Fixnum > true and you can try ancestors ... which is nice for getting to know ruby's class tree. irb(main):002:0> Fixnum.ancestors [Fixnum, Integer, Precision, Numeric, Comparable, Object, Kernel] s. -- Stefan Schmiedl EDV-Beratung, Programmierung, Schulung Loreleystr. 5, 94315 Straubing, Germany Tel. (0 94 21) 74 01 06 Public Key: http://xss.de/stefan.public shhhh ... I can't hear my code!