method
invoke_with_yield
1.2.0 -
Show latest stable
- Class:
Spec::Mocks::BaseExpectation
invoke_with_yield(block)protected
No documentation available.
# File lib/spec/mocks/message_expectation.rb, line 143
def invoke_with_yield(block)
if block.nil?
@error_generator.raise_missing_block_error @args_to_yield
end
value = nil
@args_to_yield.each do |args_to_yield_this_time|
if block.arity > -1 && args_to_yield_this_time.length != block.arity
@error_generator.raise_wrong_arity_error args_to_yield_this_time, block.arity
end
value = block.call(*args_to_yield_this_time)
end
value
end