Class: Mutant::Cache
- Inherits:
-
Object
- Object
- Mutant::Cache
- Includes:
- Adamantium::Mutable
- 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
Root node parsed from 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
11 12 13 |
# File 'lib/mutant/cache.rb', line 11 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.
Root node parsed from file
22 23 24 25 26 |
# File 'lib/mutant/cache.rb', line 22 def parse(path) @cache.fetch(path) do @cache[path] = Parser::CurrentRuby.parse(File.read(path)) end end |