class ShellBase

Constants

VERSION

Public Class Methods

new() click to toggle source
# File lib/shell_base.rb, line 7
def initialize
  while readline; end
end

Public Instance Methods

exit() click to toggle source
# File lib/shell_base.rb, line 15
def exit
  puts "bye."; raise Exit
end
method_missing(method_name) click to toggle source
# File lib/shell_base.rb, line 19
def method_missing(method_name)
  puts method_name.to_s + ": Command not found"
end
prompt() click to toggle source
# File lib/shell_base.rb, line 11
def prompt
  "$ "
end
readline() click to toggle source
# File lib/shell_base.rb, line 23
def readline
  input = Readline.readline(prompt, true).split(" ")
  cmd = input.shift
  if cmd
    begin
      send(cmd, *input)
    rescue Exit
      return false
    end
  end
  true
end