Cache loaded module to suppress method redefined warnings
This commit is contained in:
parent
9087252067
commit
fd956c72ea
@ -21,6 +21,7 @@ module IRB # :nodoc:
|
|||||||
LOCALE_DIR = "/lc/"
|
LOCALE_DIR = "/lc/"
|
||||||
|
|
||||||
@@legacy_encoding_alias_map = {}.freeze
|
@@legacy_encoding_alias_map = {}.freeze
|
||||||
|
@@loaded = []
|
||||||
|
|
||||||
def initialize(locale = nil)
|
def initialize(locale = nil)
|
||||||
@lang = @territory = @encoding_name = @modifier = nil
|
@lang = @territory = @encoding_name = @modifier = nil
|
||||||
@ -107,7 +108,10 @@ module IRB # :nodoc:
|
|||||||
def load(file, priv=nil)
|
def load(file, priv=nil)
|
||||||
found = find(file)
|
found = find(file)
|
||||||
if found
|
if found
|
||||||
|
unless @@loaded.include?(found)
|
||||||
|
@@loaded << found # cache
|
||||||
return real_load(found, priv)
|
return real_load(found, priv)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
raise LoadError, "No such file to load -- #{file}"
|
raise LoadError, "No such file to load -- #{file}"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user