class_exists
-
Classes in Ruby are reference by a constant (a variable beginning with an uppercase letter). We can check if a class is defined by verifying that the constant exists for the class name using
Module.const_defined?.PHP
class Car {} $exists = class_exists('Car'); var_export($exists); // => true
Ruby
class Car; end p Module.const_defined?("Car") # => 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.

