class Sol::CLI
Public Class Methods
new()
click to toggle source
# File lib/sol/cli.rb, line 9 def initialize @interpreter = Interpreter.new if file = ARGV.first @interpreter.eval File.read(file) else repl() end end
Public Instance Methods
repl()
click to toggle source
# File lib/sol/cli.rb, line 25 def repl Readline.completion_proc = proc {} # Disable tab puts "Sol #{VERSION} running on ruby #{RUBY_VERSION}" loop do begin line = Readline::readline('> ') Readline::HISTORY.push(line) value = @interpreter.eval(line) puts "#{value.ruby_value.inspect}" rescue Interrupt puts "" # To fix the prompt not being printed on a newline puts "Use quit(), exit() or Ctrl-D to exit the repl" end end end