8335cccafb
* Reduce redunrant 'Return' prefix on summaries * Improve summary line to reflect the semantics of operation better
29 lines
502 B
Ruby
29 lines
502 B
Ruby
module Mutant
|
|
# An AST cache
|
|
class Cache
|
|
include Equalizer.new, Adamantium::Mutable
|
|
|
|
# Initialize object
|
|
#
|
|
# @return [undefined]
|
|
#
|
|
# @api private
|
|
def initialize
|
|
@cache = {}
|
|
end
|
|
|
|
# Root node parsed from 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
|