GitHub

@@ -380,6 +380,7 @@ method_to_s(mrb_state *mrb, mrb_value self)

380380

mrb_value klass = mrb_iv_get(mrb, self, MRB_SYM(_klass));

381381

mrb_value name = mrb_iv_get(mrb, self, MRB_SYM(_name));

382382

mrb_value str = mrb_str_new_lit(mrb, "#<");

383+

mrb_value proc = mrb_iv_get(mrb, self, MRB_SYM(_proc));

383384384385

mrb_str_cat_cstr(mrb, str, mrb_obj_classname(mrb, self));

385386

mrb_str_cat_lit(mrb, str, ": ");

@@ -409,6 +410,17 @@ method_to_s(mrb_state *mrb, mrb_value self)

409410

mrb_str_concat(mrb, str, name);

410411

}

411412

finish:;

413+

const struct RProc *p = mrb_proc_ptr(proc);

414+

if (MRB_PROC_ALIAS_P(p)) {

415+

mrb_sym mid;

416+

while (MRB_PROC_ALIAS_P(p)) {

417+

mid = p->body.mid;

418+

p = p->upper;

419+

}

420+

mrb_str_cat_lit(mrb, str, "(");

421+

mrb_str_concat(mrb, str, mrb_symbol_value(mid));

422+

mrb_str_cat_lit(mrb, str, ")#");

423+

}

412424

mrb_value loc = method_source_location(mrb, self);

413425

if (mrb_array_p(loc) && RARRAY_LEN(loc) == 2) {

414426

mrb_str_cat_lit(mrb, str, " ");

Read the original on github.com ↗