is_subclass_of
-
We can check if an object in Ruby is a subclass of another object using the
Object.kind_of?method.PHP
class Dinosaur {} class TRex extends Dinosaur {} $t = new TRex; $result = is_subclass_of($t, "Dinosaur"); var_export($result); // => true
Ruby
class Dinosaur; end class TRex < Dinosaur; end t = TRex.new p t.kind_of?(Dinosaur) # => true
see also
Looking for Rails or PHP web application development, integration, and training?
Rails for PHP is brought to you by Maintainable Software. Get custom web applications and personalized training from the authors of the book and website.

