get_declared_interfaces

  • There are no interfaces in Ruby the way there is in PHP. Ruby uses class inheritance or module mixins to specify an interface for an object. Both class and module names are constants. We can get the list of all classes and modules by viewing the all defined constants using Module.constants.

    PHP

    $result = get_declared_interfaces();
    var_export($result);
    // => array(0 => 'Traversable', 1 => 'IteratorAggregate', ...)

    Ruby

    p Module.constants
    # => ["TrueClass", "ObjectSpace", ...]

    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.