free_mutant/lib/mutant/parser.rb
2015-11-15 23:13:43 +00:00

23 lines
408 B
Ruby

module Mutant
# An AST Parser
class Parser
include Adamantium::Mutable, Equalizer.new
# Initialize object
#
# @return [undefined]
def initialize
@cache = {}
end
# Parse path into AST
#
# @param [Pathname] path
#
# @return [AST::Node]
def call(path)
@cache[path] ||= ::Parser::CurrentRuby.parse(path.read)
end
end # Parser
end # Mutant