Skip to content

Commit 40fc4ae

Browse files
author
md-work
committed
Wrapping &blocks only when there is a Func check. (bug 278)
1 parent da2ad64 commit 40fc4ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/contracts/call_with.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def call_with_inner(returns, this, *args, &blk)
8181
method.call(*args, &blk)
8282
else
8383
# original method name reference
84-
added_block = blk ? lambda { |*params| blk.call(*params) } : nil
85-
method.send_to(this, *args, &added_block)
84+
blk = lambda { |*params| blk.call(*params) } if blk && blk.is_a?(Contract)
85+
method.send_to(this, *args, &blk)
8686
end
8787

8888
unless @ret_validator[result]

0 commit comments

Comments
 (0)