class RSpec::Mocks::AndYieldImplementation

@private
Handles the implementation of an ‘and_yield` declaration.

def call(*_args_to_ignore, &block)

def call(*_args_to_ignore, &block)
  return if @args_to_yield.empty? && @eval_context.nil?
  @error_generator.raise_missing_block_error @args_to_yield unless block
  value = nil
  block_signature = Support::BlockSignature.new(block)
  @args_to_yield.each do |args|
    unless Support::StrictSignatureVerifier.new(block_signature, args).valid?
      @error_generator.raise_wrong_arity_error(args, block_signature)
    end
    value = @eval_context ? @eval_context.instance_exec(*args, &block) : yield(*args)
  end
  value
end

def initialize(args_to_yield, eval_context, error_generator)

def initialize(args_to_yield, eval_context, error_generator)
  @args_to_yield = args_to_yield
  @eval_context = eval_context
  @error_generator = error_generator
end