method
constants
v2_5_5 -
Show latest stable
- Class:
Module
constants(p1 = v1)public
Returns an array of the names of the constants accessible in mod. This includes the names of constants in any included modules (example at start of section), unless the inherit parameter is set to false.
The implementation makes no guarantees about the order in which the constants are yielded.
IO .constants .include? (:SYNC) #=> true IO .constants (false).include? (:SYNC) #=> false
Also see Module::const_defined?.
VALUE
rb_mod_constants(int argc, const VALUE *argv, VALUE mod)
{
VALUE inherit;
if (argc == 0) {
inherit = Qtrue;
}
else {
rb_scan_args(argc, argv, "01", &inherit);
}
if (RTEST(inherit)) {
return rb_const_list(rb_mod_const_of(mod, 0));
}
else {
return rb_local_constants(mod);
}
}