Skip to content

Commit

Permalink
Second debugging version of previous commit (40fc4ae), to wrap &block…
Browse files Browse the repository at this point in the history
…s only when there is a Func check. (bug 278)
  • Loading branch information
md-work committed Feb 5, 2018
1 parent f02270d commit 83fe7ca
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions lib/contracts/call_with.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,8 @@ def call_with_inner(returns, this, *args, &blk)
method.call(*args, &blk)
else
# original method name reference
target_block = nil
blk_is_contract = false
if blk
if blk.is_a?(Contract) # rubocop:disable Style/IfUnlessModifier
blk_is_contract = true
end
end
if blk_is_contract # rubocop:disable Style/ConditionalAssignment
target_block = lambda { |*params| blk.call(*params) }
else
target_block = blk
end
target_block = blk
target_block = lambda { |*params| blk.call(*params) } if blk_is_contract
method.send_to(this, *args, &target_block)
end

Expand Down

0 comments on commit 83fe7ca

Please sign in to comment.