diff options
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/variable.c b/variable.c index 41f935dff8..b29ce55cce 100644 --- a/variable.c +++ b/variable.c @@ -195,10 +195,20 @@ VALUE rb_path2class(path) const char *path; { + VALUE c; + if (path[0] == '#') { rb_raise(rb_eArgError, "can't retrieve anonymous class %s", path); } - return rb_eval_string(path); + c = rb_eval_string(path); + switch (TYPE(c)) { + case T_MODULE: + case T_CLASS: + break; + default: + rb_raise(rb_eTypeError, "class path %s does not point class", path); + } + return c; } void |