Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 535 Bytes

File metadata and controls

25 lines (18 loc) · 535 Bytes

get_declared_classes

Both class and module names are constants in Ruby. We can get the list of all classes and modules by viewing the all defined constants using Module.constants.

{{code:php $result = get_declared_classes(); var_export($result); // => array(0 => 'stdClass', 1 => 'Exception', ...) }}

{{code:ruby p Module.constants # => ["TrueClass", "ObjectSpace", ...] }}

{{related: classobj/class_exists classobj/get_declared_interfaces classobj/get_defined_functions }}