(https://github.com/ruby/irb/pull/571)
* Simplify Locale#load
Instead of loading file content with `MagicFile` and then evaluting it,
we can just use `Kernel.load` to load the file.
* Remove unused optional argument
* Remove unused Locale#require and #toplevel_load
(https://github.com/ruby/irb/pull/569)
We don't have to load another file to define the legacy encoding aliases
map because there's only one definition of it. We can define it in
locale.rb directly.
(https://github.com/ruby/irb/pull/568)
In 3ee79e89ad,
`encoding_aliases.rb` was introduced to return the correct encoding object for
`ujis` and `euc` encodings.
However, the return value of `@@legacy_encoding_alias_map[@encoding_name]`
is always overridden by a second look up with `Encoding.find(@encoding_name)`.
So the logic didn't work as expected.
This commit fixes the problem.
If uplevel keyword is given, the warning message is prepended
with caller file and line information and the string "warning: ".
The use of the uplevel keyword makes Kernel#warn format output
similar to how rb_warn formats output.
This patch modifies net/ftp and net/imap to use Kernel#warn
instead of $stderr.puts or $stderr.printf, since they are used
for printing warnings.
This makes lib/cgi/core and tempfile use $stderr.puts instead of
warn for debug logging, since they are used for debug printing
and not for warning.
This does not modify bundler, rubygems, or rdoc, as those are
maintained outside of ruby and probably wish to remain backwards
compatible with older ruby versions.
rb_warn_m code is originally from nobu, but I've changed it
so that it only includes the path and lineno from uplevel
(not the method), and also prepends the string "warning: ",
to make it more similar to rb_warn.
From: Jeremy Evans code@jeremyevans.net
Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Gem might be undefined if --disable-gems. [ruby-core:34990]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
some platoform has a locale without territory but with
encoding.
(#each_sub_locale): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to load a localization from a gem.
(IRB::Locale#lc_path): obsoleted because of the change of #search_file
(IRB::Locale#each_localized_path): new private method, based on lc_path
(IRB::Locale#find): follows the change of #search_file.
(IRB::Locale#load): removed duplicate with #find.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@20862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-dev:26872]
* lib/irb/locale.rb: support to print help message when OS locale is
ja_JP.utf-8. [ruby-dev:26872]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
empty path, just ignore.
* dir.c: remove <sys/parm.h> inclusion.
* compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using
rb_cmpint().
* error.c (init_syserr): remove sys_nerr dependency.
* numeric.c (num_cmp): added to satisfy Comparable assumption.
* eval.c (rb_add_method): "initialize" should be public if it is a
singleton method.
* regex.c (re_match): avoid dereferencing if size == 0.
(ruby-bugs-ja:PR#360)
* time.c (time_cmp): should return nil if an operand is not a
number nor time. (ruby-bugs-ja:PR#359)
* file.c (rb_stat_cmp): should return nil if an operand is not
File::Stat.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e