lib/mutant/registry.rb in mutant-0.10.30 vs lib/mutant/registry.rb in mutant-0.10.31

- old
+ new

@@ -1,17 +1,17 @@ # frozen_string_literal: true module Mutant # Registry for mapping AST types to classes class Registry - include Concord.new(:contents) + include Concord.new(:contents, :default) # Initialize object # # @return [undefined] - def initialize - super({}) + def initialize(default) + super({}, default) end # Raised when the type is an invalid type RegistryError = Class.new(TypeError) @@ -32,10 +32,10 @@ # # @param [Symbol] type # # @return [Class<Mutator>] def lookup(type) - contents.fetch(type, Mutator::Node::Generic) + contents.fetch(type, &default) end end # Registry end # Mutant