diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-18 13:09:26 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-18 13:09:26 +0000 |
| commit | 9b872832a1417e792b85e6aa33099ae0a3ca82cf (patch) | |
| tree | 5e59d6e126eff13c9e661aa12f0b33f5db20b6c8 /lib/irb/help.rb | |
| parent | 698acd7804cb791bbf9725bfd6a915914e0e3d23 (diff) | |
| download | ruby-9b872832a1417e792b85e6aa33099ae0a3ca82cf.tar.gz ruby-9b872832a1417e792b85e6aa33099ae0a3ca82cf.tar.xz ruby-9b872832a1417e792b85e6aa33099ae0a3ca82cf.zip | |
* lib/irb/init.rb (IRB.opt_parse): (M17N) adds -U and -E as command
line options. [ruby-dev:37161]. Fixes #711.
improved long optinos.
* lib/irb/init.rb (IRB.set_encoding): new subroutine for IRB.opt_parse
* lib/irb/input-method.rb (IRB::StdioInputMethod): (M17N) regards
scripts that user types as encoded in the external_encoding.
* lib/irb/input-method.rb (IRB::ReadlineInputMethod): ditto.
* lib/irb/input-method.rb (IRB::FileInputMethod): (M17N) respects
magic comment.
* lib/irb/help.rb (IRB.print_usage): (M17N) respects magic comment
in the resource file.
* lib/irb/lc/help-message: adds -U and -E.
* lib/irb/lc/ja/help-message: ditto. re-encoded from ISO-2022-JP into UTF-8.
* lib/irb/lc/ja/encoding_aliases.rb: new file. provides Japanese specific
character encoding name table for backward compatibility.
* lib/irb/lc/ja/error.rb: re-eoncoded from ISO-2022-JP into UTF-8.
magic comment.
* lib/irb/locale.rb: integrated with Ruby 1.9's M17N support.
* lib/irb/magic-file.rb: new file. utility to handle files with magic
comment and opens in the correct encoding.
* lib/irb/ruby-lex.rb (RubyLex#each_top_level_statement): recovers
character encoding for a statement after it lexed so that irb can
eval the statement in correct encoding.
* lib/irb/src_encoding.rb: new file. utility.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/help.rb')
| -rw-r--r-- | lib/irb/help.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/irb/help.rb b/lib/irb/help.rb index 01e5878d1..2b064d5d6 100644 --- a/lib/irb/help.rb +++ b/lib/irb/help.rb @@ -9,24 +9,27 @@ # # +require 'irb/magic-file' + module IRB def IRB.print_usage lc = IRB.conf[:LC_MESSAGES] path = lc.find("irb/help-message") space_line = false - File.foreach(path) do - |l| - if /^\s*$/ =~ l - lc.puts l unless space_line - space_line = true - next + IRB::MagicFile.open(path){|f| + f.each_line do |l| + if /^\s*$/ =~ l + lc.puts l unless space_line + space_line = true + next + end + space_line = false + + l.sub!(/#.*$/, "") + next if /^\s*$/ =~ l + lc.puts l end - space_line = false - - l.sub!(/#.*$/, "") - next if /^\s*$/ =~ l - lc.puts l - end + } end end |
