diff options
author | Stan Lo <stan001212@gmail.com> | 2023-04-26 16:05:59 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-04-26 15:06:05 +0000 |
commit | fe0b23b42f6a2c774ad2b45851765625a151f834 (patch) | |
tree | 483fced14a6558cea7f471e5620c4ab7764ce71a /lib | |
parent | 6339cb70c3bcc54696e98c303dd4b26ed3d57afd (diff) | |
download | ruby-fe0b23b42f6a2c774ad2b45851765625a151f834.tar.gz |
[ruby/irb] Remove encoding_aliases.rb
(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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/lc/ja/encoding_aliases.rb | 13 | ||||
-rw-r--r-- | lib/irb/locale.rb | 9 |
2 files changed, 6 insertions, 16 deletions
diff --git a/lib/irb/lc/ja/encoding_aliases.rb b/lib/irb/lc/ja/encoding_aliases.rb deleted file mode 100644 index 08180c3ec2..0000000000 --- a/lib/irb/lc/ja/encoding_aliases.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: false -module IRB - # :stopdoc: - - class Locale - @@legacy_encoding_alias_map = { - 'ujis' => Encoding::EUC_JP, - 'euc' => Encoding::EUC_JP - }.freeze - end - - # :startdoc: -end diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb index d7019039ea..7615a4e8d8 100644 --- a/lib/irb/locale.rb +++ b/lib/irb/locale.rb @@ -15,7 +15,11 @@ module IRB # :nodoc: ]x LOCALE_DIR = "/lc/" - @@legacy_encoding_alias_map = {}.freeze + LEGACY_ENCODING_ALIAS_MAP = { + 'ujis' => Encoding::EUC_JP, + 'euc' => Encoding::EUC_JP + } + @@loaded = [] def initialize(locale = nil) @@ -26,8 +30,7 @@ module IRB # :nodoc: @lang, @territory, @encoding_name, @modifier = m[:language], m[:territory], m[:codeset], m[:modifier] if @encoding_name - begin load 'irb/encoding_aliases.rb'; rescue LoadError; end - if @encoding = @@legacy_encoding_alias_map[@encoding_name] + if @encoding = LEGACY_ENCODING_ALIAS_MAP[@encoding_name] warn(("%s is obsolete. use %s" % ["#{@lang}_#{@territory}.#{@encoding_name}", "#{@lang}_#{@territory}.#{@encoding.name}"]), uplevel: 1) else @encoding = Encoding.find(@encoding_name) rescue nil |