Module: Mutant::Mutator::Registry
- Defined in:
- lib/mutant/mutator/registry.rb
Overview
Registry for mutators
Constant Summary collapse
- InvalidTypeError =
Raised when the type is an invalid type
Class.new(TypeError)
- DuplicateTypeError =
Raised when the type is a duplicate
Class.new(ArgumentError)
Class Method Summary collapse
-
.lookup(node) ⇒ Class
private
Lookup mutator class for node.
-
.register(type, mutator_class) ⇒ self
private
Register mutator class for AST node class.
Class Method Details
.lookup(node) ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Lookup mutator class for node
41 42 43 44 45 46 |
# File 'lib/mutant/mutator/registry.rb', line 41 def self.lookup(node) type = node.type registry.fetch(type) do raise ArgumentError, "No mutator to handle: #{type.inspect}" end end |
.register(type, mutator_class) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Register mutator class for AST node class
23 24 25 26 27 28 |
# File 'lib/mutant/mutator/registry.rb', line 23 def self.register(type, mutator_class) assert_valid_type(type) assert_unique_type(type) registry[type] = mutator_class self end |