3390abc675
This will allow to use reporters from matchers avoiding stupid direct writes to $stderr. Also it will allow to remove matching from CLI altogether in a phase of the runner. Allowing to decouple Mutant::Config from VM environment allowing to serialize it ;) Step by step. Takes a while.
31 lines
508 B
Ruby
31 lines
508 B
Ruby
module Mutant
|
|
# An AST cache
|
|
class Cache
|
|
include Equalizer.new, Adamantium::Mutable
|
|
|
|
# Initialize object
|
|
#
|
|
# @return [undefined]
|
|
#
|
|
# @api private
|
|
#
|
|
def initialize
|
|
@cache = {}
|
|
end
|
|
|
|
# Return node for file
|
|
#
|
|
# @param [#to_s] path
|
|
#
|
|
# @return [AST::Node]
|
|
#
|
|
# @api private
|
|
#
|
|
def parse(path)
|
|
@cache.fetch(path) do
|
|
@cache[path] = Parser::CurrentRuby.parse(File.read(path))
|
|
end
|
|
end
|
|
|
|
end # Cache
|
|
end # Mutant
|