Class: RSpec::Matchers::BuiltIn::RespondTo Private
- Inherits:
 - 
      Object
        
- Object
 - RSpec::Matchers::BuiltIn::RespondTo
 
 - Includes:
 - Composable
 - Defined in:
 - lib/rspec/matchers/built_in/respond_to.rb
 
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the implementation for respond_to.
Not intended to be instantiated directly.
Instance Method Summary (collapse)
- 
  
      - (Object) argument 
      (also: #arguments)
  
    
No-op.
 - - (String) description private
 - - (String) failure_message private
 - - (String) failure_message_when_negated private
 - 
  
      - (RespondTo) initialize(*names) 
  
    constructor
  private
    
A new instance of RespondTo.
 - 
  
      - (Object) with(n) 
  
    
Specifies the number of expected arguments.
 
Methods included from Composable
#===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?
Constructor Details
- (RespondTo) initialize(*names)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RespondTo
      12 13 14 15  | 
    
      # File 'lib/rspec/matchers/built_in/respond_to.rb', line 12 def initialize(*names) @names = names @expected_arity = nil end  | 
  
Instance Method Details
- (Object) argument Also known as: arguments
No-op. Intended to be used as syntactic sugar when using with.
      32 33 34  | 
    
      # File 'lib/rspec/matchers/built_in/respond_to.rb', line 32 def argument self end  | 
  
- (String) description
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      61 62 63  | 
    
      # File 'lib/rspec/matchers/built_in/respond_to.rb', line 61 def description "respond to #{pp_names}#{with_arity}" end  | 
  
- (String) failure_message
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      49 50 51  | 
    
      # File 'lib/rspec/matchers/built_in/respond_to.rb', line 49 def "expected #{@actual.inspect} to respond to #{@failing_method_names.map { |name| name.inspect }.join(', ')}#{with_arity}" end  | 
  
- (String) failure_message_when_negated
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      55 56 57  | 
    
      # File 'lib/rspec/matchers/built_in/respond_to.rb', line 55 def .sub(/to respond to/, 'not to respond to') end  | 
  
- (Object) with(n)
Specifies the number of expected arguments.
      22 23 24 25  | 
    
      # File 'lib/rspec/matchers/built_in/respond_to.rb', line 22 def with(n) @expected_arity = n self end  |