const_get(p1, p2 = v2)
public
Returns the value of the named constant in mod.
Math.const_get(:PI)
If the constant is not defined or is defined by the ancestors and inherit is false,
NameError will be raised.
Show source
static VALUE
rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
{
VALUE name, recur;
ID id;
if (argc == 1) {
name = argv[0];
recur = Qtrue;
}
else {
rb_scan_args(argc, argv, "11", &name, &recur);
}
id = rb_to_id(name);
if (!rb_is_const_id(id)) {
rb_name_error(id, "wrong constant name %s", rb_id2name(id));
}
return RTEST(recur) ? rb_const_get(mod, id) : rb_const_get_at(mod, id);
}