Class: LiveAST::Cache
- Inherits:
-
Object
- Object
- LiveAST::Cache
- Defined in:
- lib/live_ast/linker.rb
Instance Method Summary collapse
- #fetch_ast(line) ⇒ Object
-
#initialize(*args) ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize(*args) ⇒ Cache
3 4 5 6 |
# File 'lib/live_ast/linker.rb', line 3 def initialize(*args) @source, @user_line = args @asts = nil end |
Instance Method Details
#fetch_ast(line) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/live_ast/linker.rb', line 8 def fetch_ast(line) @asts ||= LiveAST.parser.new.parse(@source).tap do @source = nil end @asts.delete(line - @user_line + 1) end |