In Ruby, does the Object class have a kind_of? method kind_of? that does what you want. Is it also an alias of is_a? :
module M; end class A include M end class B < A; end class C < B; end b = B.new b.kind_of? A
In addition, the Class class has a superclass method:
>> B.superclass => A
Note that you can find out which methods any object supports:
B.methods.sort
Would the result of this command include kind_of? methods kind_of? / is_a? / superclass .
source share