mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
proc.c: prefer name method result to inspect
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9de6c712b6
commit
581c023127
1 changed files with 5 additions and 11 deletions
16
proc.c
16
proc.c
|
@ -1943,7 +1943,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eTypeError,
|
rb_raise(rb_eTypeError,
|
||||||
"bind argument must be a subclass of % "PRIsVALUE,
|
"bind argument must be a subclass of % "PRIsVALUE,
|
||||||
rb_class_name(method->me->owner));
|
method->me->owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb_method_entry_set(mod, id, method->me, scope_visi->method_visi);
|
rb_method_entry_set(mod, id, method->me, scope_visi->method_visi);
|
||||||
|
@ -2245,7 +2245,7 @@ umethod_bind(VALUE method, VALUE recv)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eTypeError, "bind argument must be an instance of % "PRIsVALUE,
|
rb_raise(rb_eTypeError, "bind argument must be an instance of % "PRIsVALUE,
|
||||||
rb_class_name(methclass));
|
methclass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2568,17 +2568,13 @@ method_inspect(VALUE method)
|
||||||
{
|
{
|
||||||
struct METHOD *data;
|
struct METHOD *data;
|
||||||
VALUE str;
|
VALUE str;
|
||||||
const char *s;
|
|
||||||
const char *sharp = "#";
|
const char *sharp = "#";
|
||||||
VALUE mklass;
|
VALUE mklass;
|
||||||
VALUE defined_class;
|
VALUE defined_class;
|
||||||
|
|
||||||
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
|
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
|
||||||
str = rb_str_buf_new2("#<");
|
str = rb_sprintf("#<% "PRIsVALUE": ", rb_obj_class(method));
|
||||||
OBJ_INFECT_RAW(str, method);
|
OBJ_INFECT_RAW(str, method);
|
||||||
s = rb_obj_classname(method);
|
|
||||||
rb_str_buf_cat2(str, s);
|
|
||||||
rb_str_buf_cat2(str, ": ");
|
|
||||||
|
|
||||||
mklass = data->klass;
|
mklass = data->klass;
|
||||||
|
|
||||||
|
@ -2612,11 +2608,9 @@ method_inspect(VALUE method)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_str_buf_append(str, rb_class_name(mklass));
|
rb_str_buf_append(str, rb_inspect(mklass));
|
||||||
if (defined_class != mklass) {
|
if (defined_class != mklass) {
|
||||||
rb_str_buf_cat2(str, "(");
|
rb_str_catf(str, "(% "PRIsVALUE")", defined_class);
|
||||||
rb_str_buf_append(str, rb_class_name(defined_class));
|
|
||||||
rb_str_buf_cat2(str, ")");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb_str_buf_cat2(str, sharp);
|
rb_str_buf_cat2(str, sharp);
|
||||||
|
|
Loading…
Add table
Reference in a new issue