From: Joel VanderWerf Date: 2007-11-05T08:19:20+09:00 Subject: Re: Check if MyClass extends OtherClass? Joshua Muheim wrote: > How can I check if MyClass extends OtherClass? When I have an instance I > can call my_class_instance.kind_of?(OtherClass), but what can I call > when only having the class name? Use the #< and #<= methods of classes (and modules): class OtherClass end class MyClass < OtherClass end classes = [MyClass, OtherClass] classes.each do |c1| classes.each do |c2| puts "#{c1} < #{c2}" if c1 < c2 puts "#{c1} <= #{c2}" if c1 <= c2 end end __END__ Output: MyClass <= MyClass MyClass < OtherClass MyClass <= OtherClass OtherClass <= OtherClass -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407