class Object
Public Instance Methods
_readline(prompt)
click to toggle source
# File lib/rubylisp/rbl_readline.rb, line 11 def _readline(prompt) if !$history_loaded && File.exist?($histfile) $history_loaded = true if File.readable?($histfile) File.readlines($histfile).each {|l| Readline::HISTORY.push(l.chomp)} end end if line = Readline.readline(prompt, true) history = Readline::HISTORY if line.strip.empty? || (history.length > 1 && (history[-2] == history[-1])) history.pop elsif File.writable?($histfile) File.open($histfile, 'a+') {|f| f.write(line+"\n")} end return line else return nil end end