2 # irb/input-method.rb - input methods used irb
3 # $Release Version: 0.9.5$
5 # $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $
6 # by Keiju ISHITSUKA(keiju@ruby-lang.org)
17 # (ReadlineInputMethod)
19 STDIN_FILE_NAME = "(line)"
21 @RCS_ID='-$Id: input-method.rb 11708 2007-02-12 23:01:19Z shyouhei $-'
23 def initialize(file = STDIN_FILE_NAME)
26 attr_reader :file_name
31 IRB.fail NotImplementedError, "gets"
35 def readable_atfer_eof?
40 class StdioInputMethod < InputMethod
49 @line[@line_no += 1] = $stdin.gets
56 def readable_atfer_eof?
65 class FileInputMethod < InputMethod
70 attr_reader :file_name
86 class ReadlineInputMethod < InputMethod
97 if l = readline(@prompt, false)
98 HISTORY.push(l) if !l.empty?
99 @line[@line_no += 1] = l + "\n"
110 def readable_atfer_eof?