Skip to content

Commit

Permalink
Fix for JRUBY-3490: Object#instance_exec only works with blocks of 3 …
Browse files Browse the repository at this point in the history
…parameters or less?!

git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@9412 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
headius committed Mar 15, 2009
1 parent 23e1d55 commit 04f9566
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/org/jruby/RubyObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ private RubyModule getInstanceEvalClass() {
* k = Klass.new
* k.instance_exec(5) {|x| @secret+x } #=> 104
*/
@JRubyMethod(name = "instance_exec", optional = 3, frame = true)
@JRubyMethod(name = "instance_exec", optional = 3, rest = true, frame = true)
public IRubyObject instance_exec(ThreadContext context, IRubyObject[] args, Block block) {
if (!block.isGiven()) throw context.getRuntime().newArgumentError("block not supplied");

Expand Down
2 changes: 1 addition & 1 deletion test/test_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_instance_exec_args_result

def test_instance_exec_args_multiple_result
o = Object.new
assert_equal([1, 3], o.instance_exec(1, 2, 3) { |a, b, c| [a, c] })
assert_equal([1, 4], o.instance_exec(1, 2, 3, 4) { |a, b, c, d| [a, d] })
end

def test_instance_exec_no_block
Expand Down

0 comments on commit 04f9566

Please sign in to comment.