Prevent duplicate registrations
This commit is contained in:
parent
012ce53c34
commit
288724436a
1 changed files with 4 additions and 3 deletions
|
@ -15,15 +15,16 @@ module Mutant
|
|||
|
||||
# Register mutator class for AST node class
|
||||
#
|
||||
# @param [Class] ast_class
|
||||
# @param [Symbol] type
|
||||
# @param [Class] mutator_class
|
||||
#
|
||||
# @api private
|
||||
#
|
||||
# @return [self]
|
||||
#
|
||||
def self.register(ast_class,mutator_class)
|
||||
registry[ast_class]=mutator_class
|
||||
def self.register(type, mutator_class)
|
||||
raise "duplicate type registration: #{type}" if registry.key?(type)
|
||||
registry[type]=mutator_class
|
||||
self
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue