123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Matchers::MatcherDelegator Private

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
RSpec::Expectations::LegacyMatcherAdapter, RSpec::Matchers::AliasedMatcher, RSpec::Matchers::AliasedMatcherWithOperatorSupport, RSpec::Matchers::AliasedNegatedMatcher, RSpec::Expectations::LegacyMatcherAdapter::RSpec1, RSpec::Expectations::LegacyMatcherAdapter::RSpec2
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: RSpec::Matchers::BaseDelegator
Defined in: rspec-expectations/lib/rspec/matchers/matcher_delegator.rb

Overview

Provides the necessary plumbing to wrap a matcher with a decorator.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Composable - Included

#&

Alias for Composable#and.

#===

Delegates to #matches?.

#and

Creates a compound and expectation.

#description_of

Returns the description of the given object in a way that is aware of composed matchers.

#or

Creates a compound or expectation.

#values_match?

This provides a generic way to fuzzy-match an expected value against an actual value.

#|

Alias for Composable#or.

#should_enumerate?

We should enumerate arrays as long as they are not recursive.

#surface_descriptions_in

Transforms the given data structure (typically a hash or array) into a new data structure that, when #inspect is called on it, will provide descriptions of any contained matchers rather than the normal #inspect output.

#unreadable_io?,
#with_matchers_cloned

Historically, a single matcher instance was only checked against a single value.

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/matcher_delegator.rb', line 39

def method_missing(*args, &block)
  base_matcher.__send__(*args, &block)
end

Instance Attribute Details

#base_matcher (readonly)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/matcher_delegator.rb', line 33

attr_reader :base_matcher

Instance Method Details

#initialize_copy(other)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/matcher_delegator.rb', line 55

def initialize_copy(other)
  @base_matcher = @base_matcher.clone
  super
end

#respond_to?(name, include_all = false) ⇒ Boolean

:nocov:

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/matcher_delegator.rb', line 49

def respond_to?(name, include_all=false)
  super || base_matcher.respond_to?(name, include_all)
end

#respond_to_missing?(name, include_all = false) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/matcher_delegator.rb', line 44

def respond_to_missing?(name, include_all=false)
  super || base_matcher.respond_to?(name, include_all)
end