class Gondler::REPL

Public Class Methods

new() click to toggle source
# File lib/gondler/repl.rb, line 9
def initialize
end
run() click to toggle source
# File lib/gondler/repl.rb, line 5
def self.run
  new.run
end

Public Instance Methods

builtin() click to toggle source
# File lib/gondler/repl.rb, line 28
def builtin
  @builtin ||= builtin_commands.keys + ['help']
end
builtin_commands() click to toggle source
# File lib/gondler/repl.rb, line 32
def builtin_commands
  @builtin_commands ||= Gondler::CLI.commands
end
execute(line) click to toggle source
# File lib/gondler/repl.rb, line 18
def execute(line)
  cmd = line.match(/\A\w+/).to_s

  if builtin.include?(cmd)
    Gondler::CLI.start(line.split(/\s+/))
  else
    system(line)
  end
end
run() click to toggle source
# File lib/gondler/repl.rb, line 12
def run
  while (buf = Readline.readline("> ", true))
    execute(buf)
  end
end