Class: RSpec::Mocks::ArgumentMatchers::SingletonMatcher
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/argument_matchers.rb
Overview
Intended to be subclassed by stateless, immutable argument matchers. Provides a ‘<klass name>::INSTANCE` constant for accessing a global singleton instance of the matcher. There is no need to construct multiple instance since there is no state. It also facilities the special case logic we need for some of these matchers, by making it easy to do comparisons like: `[klass::INSTANCE] == args` rather than `args.count == 1 && klass === args.first`.
Direct Known Subclasses
AnyArgMatcher, AnyArgsMatcher, BooleanMatcher, NoArgsMatcher
Class Method Summary collapse
Class Method Details
.inherited(subklass) ⇒ Object
136 137 138 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/argument_matchers.rb', line 136 def self.inherited(subklass) subklass.const_set(:INSTANCE, subklass.send(:new)) end |