module LiveAST::IRBSpy

Attributes

history[W]

Public Class Methods

can_parse(code) click to toggle source
# File lib/live_ast/irb_spy.rb, line 18
def can_parse(code)
  LiveAST.parser.new.parse(code)
rescue StandardError
  false
end
checked_history() click to toggle source
# File lib/live_ast/irb_spy.rb, line 24
def checked_history
  return @history if @history

  raise NotImplementedError,
        "LiveAST cannot access history for this IRB input method"
end
code_at(line) click to toggle source
# File lib/live_ast/irb_spy.rb, line 10
def code_at(line)
  code = +""
  checked_history[line..].each do |code_line|
    code << code_line << "\n"
    return code if can_parse code
  end
end