summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-12-04 15:19:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-12-04 15:19:33 +0000
commitf4aca06c84eb57e1b7048e5c28daa03f39258ddc (patch)
tree9041f38521e1caf750aae67f0930686778c89c97 /eval.c
parent8d69c7f116d8f9053c91d86f437d6bccf4ab4a7b (diff)
* intern.h, object.c, variable.c (rb_mod_constants): added an optional
flag to search ancestors, which is defaulted to true, as well as const_defined? and const_get. [ruby-dev:29989] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index b9c0c71b56..1e582dcbcb 100644
--- a/eval.c
+++ b/eval.c
@@ -1906,11 +1906,15 @@ rb_mod_nesting(void)
*/
static VALUE
-rb_mod_s_constants(void)
+rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
{
NODE *cbase = ruby_cref;
void *data = 0;
+ if (argc > 0) {
+ return rb_mod_constants(argc, argv, rb_cModule);
+ }
+
while (cbase) {
if (!NIL_P(cbase->nd_clss)) {
data = rb_mod_const_at(cbase->nd_clss, data);
@@ -7952,7 +7956,7 @@ Init_eval(void)
rb_define_private_method(rb_cModule, "define_method", rb_mod_define_method, -1);
rb_define_singleton_method(rb_cModule, "nesting", rb_mod_nesting, 0);
- rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, 0);
+ rb_define_singleton_method(rb_cModule, "constants", rb_mod_s_constants, -1);
rb_define_singleton_method(ruby_top_self, "include", top_include, -1);
rb_define_singleton_method(ruby_top_self, "public", top_public, -1);