summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-20 02:14:57 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-20 02:14:57 (GMT)
commita8b0c2529301df76a1ea8c03ead3d0d163ab56bc (patch)
treee30b055f59b9fde1c6307adfd4ddc179762086dd /proc.c
parent3b8730058e8dc7fbbb5b888ae5623739f80702c4 (diff)
* proc.c (rb_mod_define_method): should check Symbol or not.
[Bug #11850] * test/ruby/test_method.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index cd083ec..6d153c1 100644
--- a/proc.c
+++ b/proc.c
@@ -1774,8 +1774,13 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
rb_thread_t *th = GET_THREAD();
rb_block_t *block = rb_vm_control_frame_block_ptr(th->cfp);
if (!block) rb_raise(rb_eArgError, proc_without_block);
+
body = block->proc;
- if (!body) {
+
+ if (SYMBOL_P(body)) {
+ body = rb_sym_to_proc(body);
+ }
+ else if (!body) {
body = rb_vm_make_proc_lambda(th, block, rb_cProc, TRUE);
}
#endif