7293386c26
* rubocop still warns about this on ruby 1.9.3, so it was fixed so it produces less output on travis.
32 lines
549 B
Ruby
32 lines
549 B
Ruby
# encoding: utf-8
|
|
|
|
module Mutant
|
|
# An AST cache
|
|
class Cache
|
|
# This is explicitly empty! Ask me if you are interested in reasons :D
|
|
include Equalizer.new
|
|
|
|
# Initialize object
|
|
#
|
|
# @return [undefined]
|
|
#
|
|
# @api private
|
|
#
|
|
def initialize
|
|
@cache = {}
|
|
end
|
|
|
|
# Return node for file
|
|
#
|
|
# @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
|