class Eggsh::Runner
Public Class Methods
new()
click to toggle source
# File lib/runner.rb, line 10 def initialize @shell = Eggsh::Shell.new load_rc end
Public Instance Methods
run!()
click to toggle source
# File lib/runner.rb, line 15 def run! Readline.completion_append_character = " " Readline.completion_proc = Readline::FILENAME_COMPLETION_PROC Readline.basic_word_break_characters = '' while line = read @shell.exec line end end
Private Instance Methods
load_rc()
click to toggle source
load rc file from ~/.eggshrc
# File lib/runner.rb, line 37 def load_rc path = File.expand_path RC_PATH if File.exist? path eval(IO.read path) end end
read()
click to toggle source
read a single line by readline
# File lib/runner.rb, line 27 def read line = Readline.readline(@shell.prompt, true) return nil if line.nil? if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line Readline::HISTORY.pop end line end