class RSpec::Mocks::ArgumentMatchers::SingletonMatcher
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`.
@private
Public Class Methods
inherited(subklass)
click to toggle source
# File lib/rspec/mocks/argument_matchers.rb, line 136 def self.inherited(subklass) subklass.const_set(:INSTANCE, subklass.send(:new)) end