123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Mocks::AnyInstance::FluentInterfaceProxy Private

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: BasicObject
Defined in: rspec-mocks/lib/rspec/mocks/any_instance/proxy.rb

Overview

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 Recorder return values and N ::RSpec::Mocks::MessageExpectation instances (one per instance of the any_instance klass).

Class Method Summary

Instance Method Summary

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/any_instance/proxy.rb', line 118

def method_missing(*args, &block)
  return_values = @targets.map { |t| t.__send__(*args, &block) }
  FluentInterfaceProxy.new(return_values)
end

Instance Method Details

#respond_to?(method_name, include_private = false) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/any_instance/proxy.rb', line 113

def respond_to?(method_name, include_private=false)
  super || @targets.first.respond_to?(method_name, include_private)
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/any_instance/proxy.rb', line 109

def respond_to_missing?(method_name, include_private=false)
  super || @targets.first.respond_to?(method_name, include_private)
end