lib/irb/locale.rb in irb-1.1.1 vs lib/irb/locale.rb in irb-1.2.0
- old
+ new
@@ -19,10 +19,11 @@
(?:@ (?<modifier>.*) )?
]x
LOCALE_DIR = "/lc/"
@@legacy_encoding_alias_map = {}.freeze
+ @@loaded = []
def initialize(locale = nil)
@lang = @territory = @encoding_name = @modifier = nil
@locale = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C"
if m = LOCALE_NAME_RE.match(@locale)
@@ -105,10 +106,13 @@
alias toplevel_load load
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
end