diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-14 11:39:21 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-14 11:39:21 +0000 |
commit | e76eb06feb024828034379797129d92522e28516 (patch) | |
tree | 1326c625c233ba2554043203a7697f5e3d4c49e5 /ruby_1_9_3/lib/irb/input-method.rb | |
parent | aa6e98139c8e1ea442fb2182341aaa08ff55b529 (diff) | |
parent | bede15ac5e701ed08f3fc64c2dba03d3f393c652 (diff) |
add tag v1_9_3_426v1_9_3_426
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_3_426@40737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby_1_9_3/lib/irb/input-method.rb')
-rw-r--r-- | ruby_1_9_3/lib/irb/input-method.rb | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/ruby_1_9_3/lib/irb/input-method.rb b/ruby_1_9_3/lib/irb/input-method.rb deleted file mode 100644 index 7227df4ca0..0000000000 --- a/ruby_1_9_3/lib/irb/input-method.rb +++ /dev/null @@ -1,142 +0,0 @@ -# -# irb/input-method.rb - input methods used irb -# $Release Version: 0.9.6$ -# $Revision$ -# by Keiju ISHITSUKA(keiju@ruby-lang.org) -# -# -- -# -# -# -require 'irb/src_encoding' -require 'irb/magic-file' - -module IRB - # - # InputMethod - # StdioInputMethod - # FileInputMethod - # (ReadlineInputMethod) - # - STDIN_FILE_NAME = "(line)" - class InputMethod - @RCS_ID='-$Id$-' - - def initialize(file = STDIN_FILE_NAME) - @file_name = file - end - attr_reader :file_name - - attr_accessor :prompt - - def gets - IRB.fail NotImplementedError, "gets" - end - public :gets - - def readable_atfer_eof? - false - end - end - - class StdioInputMethod < InputMethod - def initialize - super - @line_no = 0 - @line = [] - @stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") - @stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") - end - - def gets - print @prompt - line = @stdin.gets - @line[@line_no += 1] = line - end - - def eof? - @stdin.eof? - end - - def readable_atfer_eof? - true - end - - def line(line_no) - @line[line_no] - end - - def encoding - @stdin.external_encoding - end - end - - class FileInputMethod < InputMethod - def initialize(file) - super - @io = IRB::MagicFile.open(file) - end - attr_reader :file_name - - def eof? - @io.eof? - end - - def gets - print @prompt - l = @io.gets -# print @prompt, l - l - end - - def encoding - @io.external_encoding - end - end - - begin - require "readline" - class ReadlineInputMethod < InputMethod - include Readline - def initialize - super - - @line_no = 0 - @line = [] - @eof = false - - @stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") - @stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") - end - - def gets - Readline.input = @stdin - Readline.output = @stdout - if l = readline(@prompt, false) - HISTORY.push(l) if !l.empty? - @line[@line_no += 1] = l + "\n" - else - @eof = true - l - end - end - - def eof? - @eof - end - - def readable_atfer_eof? - true - end - - def line(line_no) - @line[line_no] - end - - def encoding - @stdin.external_encoding - end - end - rescue LoadError - end -end |