class LiveAST::Cache

Public Class Methods

new(*args) click to toggle source
# File lib/live_ast/linker.rb, line 5
def initialize(*args)
  @source, @user_line = args
  @asts = nil
end

Public Instance Methods

fetch_ast(line) click to toggle source
# File lib/live_ast/linker.rb, line 10
def fetch_ast(line)
  @asts ||= LiveAST.parser.new.parse(@source).tap do
    @source = nil
  end
  @asts.fetch(line - @user_line + 1, nil)
end