diff options
author | aycabta <aycabta@gmail.com> | 2019-11-25 07:27:15 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-11-25 07:27:15 +0900 |
commit | fd956c72eaeb07d26d61310a9e4b55b500237c02 (patch) | |
tree | 7ece90ae4f5b76a7a2817befe1246892f3e632a3 /lib/irb | |
parent | 90872520674dcc070d693430ee139042ba514591 (diff) | |
download | ruby-fd956c72eaeb07d26d61310a9e4b55b500237c02.tar.gz |
Cache loaded module to suppress method redefined warnings
Diffstat (limited to 'lib/irb')
-rw-r--r-- | lib/irb/locale.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb index b713f50e76..ba833eced4 100644 --- a/lib/irb/locale.rb +++ b/lib/irb/locale.rb @@ -21,6 +21,7 @@ module IRB # :nodoc: LOCALE_DIR = "/lc/" @@legacy_encoding_alias_map = {}.freeze + @@loaded = [] def initialize(locale = nil) @lang = @territory = @encoding_name = @modifier = nil @@ -107,7 +108,10 @@ module IRB # :nodoc: def load(file, priv=nil) found = find(file) if found - return real_load(found, priv) + unless @@loaded.include?(found) + @@loaded << found # cache + return real_load(found, priv) + end else raise LoadError, "No such file to load -- #{file}" end |