thoughtbot--shoulda-matchers/lib/shoulda/matchers/doublespeak/double_implementation_regis...

28 lines
553 B
Ruby

module Shoulda
module Matchers
module Doublespeak
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