diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-22 14:15:29 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-22 14:15:29 +0000 |
commit | 478c65c4687f6a5a148c843f49d22e7a1b15d3f7 (patch) | |
tree | 4fbde92f566af3fbe997463a3c685d8a0fa7c53e /proc.c | |
parent | 0ffb18de451c5e4f06af9510bf7be4ae272d176d (diff) | |
download | ruby-478c65c4687f6a5a148c843f49d22e7a1b15d3f7.tar.gz |
* proc.c (mnew): fix wrong error message when Kernel#public_method
receives name of private method. [Bug #2425]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -925,7 +925,16 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope) if (flag == NOEX_UNDEF) { flag = me->flag; if (scope && (flag & NOEX_MASK) != NOEX_PUBLIC) { - rb_print_undef(rclass, def->original_id, (int)(flag & NOEX_MASK)); + const char *v = ""; + switch (flag & NOEX_MASK) { + case NOEX_PRIVATE: v = "private"; break; + case NOEX_PROTECTED: v = "protected"; break; + } + rb_name_error(id, "method `%s' for %s `%s' is %s", + rb_id2name(id), + (TYPE(klass) == T_MODULE) ? "module" : "class", + rb_class2name(klass), + v); } } if (def && def->type == VM_METHOD_TYPE_ZSUPER) { |