Sha256: f2c70bbd7d6bd3fb4e96ddaadcd10d1912d00340214f337c659606913d454cdf

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

# typed: strict

module Mocktail
  class MatcherRegistry
    extend T::Sig

    sig { returns(MatcherRegistry) }
    def self.instance
      @matcher_registry ||= T.let(new, T.nilable(T.attached_class))
    end

    sig { void }
    def initialize
      @matchers = T.let({}, T::Hash[Symbol, T.class_of(Matchers::Base)])
    end

    sig { params(matcher_type: T.class_of(Matchers::Base)).void }
    def add(matcher_type)
      @matchers[matcher_type.matcher_name] = matcher_type
    end

    sig { params(name: Symbol).returns(T.nilable(T.class_of(Matchers::Base))) }
    def get(name)
      @matchers[name]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mocktail-2.0.0 lib/mocktail/sorbet/mocktail/value/matcher_registry.rb