Sha256: 0c3d4dcc06f6376752bf10a371f07215fc6bc4689a5d1c76d372f8b6f9b644df

Contents?: true

Size: 633 Bytes

Versions: 13

Compression:

Stored size: 633 Bytes

Contents

module Shoulda
  module Matchers
    module Doublespeak
      # @private
      module DoubleImplementationRegistry
        class << self
          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

          def registry
            @_registry ||= {}
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
shoulda-matchers-6.4.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-6.3.1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-6.3.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-6.2.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-6.1.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-6.0.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-5.3.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-5.2.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-5.1.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-5.0.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-5.0.0.rc1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.5.1 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb
shoulda-matchers-4.5.0 lib/shoulda/matchers/doublespeak/double_implementation_registry.rb