free_mutant/lib/mutant/cache.rb
Markus Schirp 8335cccafb Fix YARD summary line
* Reduce redunrant 'Return' prefix on summaries
* Improve summary line to reflect the semantics of operation better
2015-07-03 15:21:39 +00:00

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