diff options
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1196,10 +1196,16 @@ rb_mod_refine(VALUE module, VALUE klass) ID id_refinements, id_activated_refinements, id_refined_class, id_defined_at; VALUE refinements, activated_refinements; + rb_thread_t *th = GET_THREAD(); + rb_block_t *block = rb_vm_control_frame_block_ptr(th->cfp); - if (!rb_block_given_p()) { + if (!block) { rb_raise(rb_eArgError, "no block given"); } + if (block->proc) { + rb_raise(rb_eArgError, + "can't pass a Proc as a block to Module#refine"); + } Check_Type(klass, T_CLASS); CONST_ID(id_refinements, "__refinements__"); refinements = rb_attr_get(module, id_refinements); |