Class: Mutant::Cache
- Inherits:
-
Object
- Object
- Mutant::Cache
- Defined in:
- lib/mutant/cache.rb
Overview
An AST cache
Instance Method Summary collapse
-
#initialize ⇒ undefined
constructor
private
Initialize object.
-
#parse(path) ⇒ AST::Node
private
Return node for file.
Constructor Details
#initialize ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize object
15 16 17 |
# File 'lib/mutant/cache.rb', line 15 def initialize @cache = {} end |
Instance Method Details
#parse(path) ⇒ AST::Node
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return node for file
25 26 27 28 29 |
# File 'lib/mutant/cache.rb', line 25 def parse(path) @cache.fetch(path) do @cache[path] = Parser::CurrentRuby.parse(File.read(path)) end end |