From d928280cb6644d2d899aadf7bfc8cf4e1b5e2997 Mon Sep 17 00:00:00 2001 From: shugo Date: Sat, 8 Dec 2012 03:06:13 +0000 Subject: * eval.c (rb_mod_refine): raise an ArgumentError if a given block is of a Proc object. * vm_insnhelper.c (vm_call_method): store refined methods in inline cache to improve performance. It's safe now because blocks cannot be yielded with different refinements in the new specification. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_refinement.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 872ca1754a..05ac1030c5 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -616,6 +616,14 @@ class TestRefinement < Test::Unit::TestCase assert_equal('[{"1":2},{"3":4}]', x) end + def test_refine_with_proc + assert_raise(ArgumentError) do + Module.new { + refine(String, &Proc.new {}) + } + end + end + private def eval_using(mod, s) -- cgit v1.2.3