is_a?(p1) public

Returns true if class is the class of obj, or if class is one of the superclasses of obj or modules included in obj.

   module M;    end
   class A
     include M
   class B < A; end
   class C < B; end
   b = B.new
   b.instance_of? A   #=> false
   b.instance_of? B   #=> true
   b.instance_of? C   #=> false
   b.instance_of? M   #=> false
   b.kind_of? A       #=> true
   b.kind_of? B       #=> true
   b.kind_of? C       #=> false
   b.kind_of? M       #=> true
Show source
Register or log in to add new notes.