class Mutest::Registry
Constants
- RegistryError
Raised when the type is an invalid type
Public Class Methods
new()
click to toggle source
Initialize object
@return [undefined]
Calls superclass method
# File lib/mutest/registry.rb, line 9 def initialize super({}) end
Public Instance Methods
lookup(type)
click to toggle source
Lookup class for node
@param [Symbol] type
@return [Class]
@raise [ArgumentError]
raises argument error when class cannot be found
# File lib/mutest/registry.rb, line 38 def lookup(type) contents.fetch(type) do raise RegistryError, "No entry for: #{type.inspect}" end end
register(type, klass)
click to toggle source
Register class for AST
node class
@param [Symbol] type @param [Class] class
@return [self]
# File lib/mutest/registry.rb, line 22 def register(type, klass) raise RegistryError, "Invalid type registration: #{type.inspect}" unless AST::Types::ALL.include?(type) raise RegistryError, "Duplicate type registration: #{type.inspect}" if contents.key?(type) contents[type] = klass self end