mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Cache loaded module to suppress method redefined warnings
This commit is contained in:
parent
9087252067
commit
fd956c72ea
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue