Sha256: aa8cbd92a89049d64b6260fe676c73b7e5ab62e0c6e959d3c43aba9502675d22

Contents?: true

Size: 570 Bytes

Versions: 24

Compression:

Stored size: 570 Bytes

Contents

module Shoulda
  module Matchers
    module Doublespeak
      # @private
      module DoubleImplementationRegistry
        class << self
          REGISTRY = {}

          def find(type)
            find_class!(type).create
          end

          def register(klass, type)
            REGISTRY[type] = klass
          end

          private

          def find_class!(type)
            REGISTRY.fetch(type) do
              raise ArgumentError, "No double implementation class found for '#{type}'"
            end
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
shoulda-matchers-4.4.1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.4.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.3.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.2.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.1.2 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.1.1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.1.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.0.1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-3.1.3 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.0.0.rc1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-3.1.2 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-3.1.1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-3.1.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-3.0.1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-3.0.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-3.0.0.rc1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-2.8.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-2.8.0.rc2 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-2.8.0.rc1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb