Skip to content

Commit 83fe7ca

Browse files
author
md-work
committed
Second debugging version of previous commit (40fc4ae), to wrap &blocks only when there is a Func check. (bug 278)
1 parent f02270d commit 83fe7ca

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

lib/contracts/call_with.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,8 @@ def call_with_inner(returns, this, *args, &blk)
8181
method.call(*args, &blk)
8282
else
8383
# original method name reference
84-
target_block = nil
85-
blk_is_contract = false
86-
if blk
87-
if blk.is_a?(Contract) # rubocop:disable Style/IfUnlessModifier
88-
blk_is_contract = true
89-
end
90-
end
91-
if blk_is_contract # rubocop:disable Style/ConditionalAssignment
92-
target_block = lambda { |*params| blk.call(*params) }
93-
else
94-
target_block = blk
95-
end
84+
target_block = blk
85+
target_block = lambda { |*params| blk.call(*params) } if blk_is_contract
9686
method.send_to(this, *args, &target_block)
9787
end
9888

0 commit comments

Comments
 (0)