@private Delegates messages to each of the given targets in order to provide the fluent interface that is available off of message expectations when dealing with `any_instance`.
`targets` will typically contain 1 of the `AnyInstance::Recorder` return values and N `MessageExpectation` instances (one per instance of the `any_instance` klass).
# File lib/rspec/mocks/any_instance/proxy.rb, line 91 def initialize(targets) @targets = targets end
# File lib/rspec/mocks/any_instance/proxy.rb, line 105 def method_missing(*args, &block) return_values = @targets.map { |t| t.__send__(*args, &block) } FluentInterfaceProxy.new(return_values) end
# File lib/rspec/mocks/any_instance/proxy.rb, line 100 def respond_to?(method_name, include_private = false) super || @targets.first.respond_to?(method_name, include_private) end
# File lib/rspec/mocks/any_instance/proxy.rb, line 96 def respond_to_missing?(method_name, include_private = false) super || @targets.first.respond_to?(method_name, include_private) end