diff options
Diffstat (limited to 'mrbgems/mruby-method/src')
| -rw-r--r-- | mrbgems/mruby-method/src/method.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/mrbgems/mruby-method/src/method.c b/mrbgems/mruby-method/src/method.c index 600567cac..9f1134227 100644 --- a/mrbgems/mruby-method/src/method.c +++ b/mrbgems/mruby-method/src/method.c @@ -212,19 +212,8 @@ static mrb_value method_arity(mrb_state *mrb, mrb_value self) { mrb_value proc = mrb_iv_get(mrb, self, mrb_intern_lit(mrb, "proc")); - struct RProc *rproc; - struct RClass *orig; - mrb_value ret; - - if (mrb_nil_p(proc)) - return mrb_fixnum_value(-1); - - rproc = mrb_proc_ptr(proc); - orig = rproc->c; - rproc->c = mrb->proc_class; - ret = mrb_funcall(mrb, proc, "arity", 0); - rproc->c = orig; - return ret; + mrb_int arity = mrb_nil_p(proc) ? -1 : mrb_proc_arity(mrb_proc_ptr(proc)); + return mrb_fixnum_value(arity); } static mrb_value @@ -327,7 +316,7 @@ name_error: s = mrb_class_name(mrb, c); mrb_raisef( mrb, E_NAME_ERROR, - "undefined method `%S' for class `%S'", + "undefined method '%S' for class '%S'", mrb_sym2str(mrb, name), mrb_str_new_static(mrb, s, strlen(s)) ); |
