From: Justin Bailey Date: 2006-12-21T06:53:25+09:00 Subject: Re: reflecting on objects without creating one ------=_Part_34225_13194805.1166651601734 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 12/20/06, _Kevin wrote: > > Let's say I have two constants > > a = Integer > b = Numeric > > Does anyone have any idea how to see if 'a' is a subclass of 'b' > WITHOUT creating an object of class 'a'? irb(main):021:0> a = Numeric => Numeric irb(main):022:0> b = Integer => Integer irb(main):023:0> a.ancestors => [Numeric, Comparable, Object, Kernel] irb(main):024:0> a.ancestors.include? b => false irb(main):025:0> b.ancestors.include? a => true irb(main):026:0> "b.ancestors.include? a" seems to do it. Notice I reversed your definitions of "a" & "b" (not for any particular reason, that's just how it worked out). Justin ------=_Part_34225_13194805.1166651601734--