From 8d81bcd71fc31b53fcc914f401394c22bbc2fac3 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 17 Dec 2007 23:01:50 +0000 Subject: * proc.c (rb_obj_public_method): Object#public_method to retrieve public method object. * proc.c (rb_mod_public_instance_method): Module#public_instance_method to retrieve public instance method from class / module. * proc.c (mnew): visibility check added. * eval_error.ci (rb_print_undef): add rb_ prefix. * eval_error.ci (rb_print_undef): add visibility in the error message. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval_error.ci | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'eval_error.ci') diff --git a/eval_error.ci b/eval_error.ci index 210dce073..94fb18029 100644 --- a/eval_error.ci +++ b/eval_error.ci @@ -207,9 +207,17 @@ ruby_error_print(void) } void -print_undef(VALUE klass, ID id) +rb_print_undef(VALUE klass, ID id, int scope) { - rb_name_error(id, "undefined method `%s' for %s `%s'", + char *v; + + switch (scope) { + default: + case NOEX_PUBLIC: v = ""; break; + case NOEX_PRIVATE: v = " private"; break; + case NOEX_PROTECTED: v = " protected"; break; + } + rb_name_error(id, "undefined%s method `%s' for %s `%s'", v, rb_id2name(id), (TYPE(klass) == T_MODULE) ? "module" : "class", rb_class2name(klass)); -- cgit