2 # irb/input-method.rb - input methods used irb
3 # $Release Version: 0.9.5$
5 # by Keiju ISHITSUKA(keiju@ruby-lang.org)
16 # (ReadlineInputMethod)
18 STDIN_FILE_NAME = "(line)"
22 def initialize(file = STDIN_FILE_NAME)
25 attr_reader :file_name
30 IRB.fail NotImplementedError, "gets"
34 def readable_atfer_eof?
39 class StdioInputMethod < InputMethod
48 @line[@line_no += 1] = $stdin.gets
55 def readable_atfer_eof?
64 class FileInputMethod < InputMethod
69 attr_reader :file_name
85 class ReadlineInputMethod < InputMethod
96 Readline.input = STDIN
97 Readline.output = STDOUT
98 if l = readline(@prompt, false)
99 HISTORY.push(l) if !l.empty?
100 @line[@line_no += 1] = l + "\n"
111 def readable_atfer_eof?