Class: RSpec::Matchers::MatcherDelegator

Inherits:
Object
  • Object
show all
Includes:
Composable
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/matcher_delegator.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Composable

#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?

Constructor Details

#initialize(base_matcher) ⇒ MatcherDelegator

Returns a new instance of MatcherDelegator.



9
10
11
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/matcher_delegator.rb', line 9

def initialize(base_matcher)
  @base_matcher = base_matcher
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



13
14
15
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/matcher_delegator.rb', line 13

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

Instance Attribute Details

#base_matcherObject (readonly)

Returns the value of attribute base_matcher.



7
8
9
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/matcher_delegator.rb', line 7

def base_matcher
  @base_matcher
end

Instance Method Details

#initialize_copy(other) ⇒ Object



29
30
31
32
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/matcher_delegator.rb', line 29

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

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

:nocov:

Returns:

  • (Boolean)


23
24
25
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/matcher_delegator.rb', line 23

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

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

Returns:

  • (Boolean)


18
19
20
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/matcher_delegator.rb', line 18

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