class Sources::Local::CachedLoader

Loader for locally-cached data, to allow merging Unicode CLDR data with existing local data

def from_cache(country_code)

def from_cache(country_code)
  @loaded_countries[country_code]
end

def initialize(klass)

def initialize(klass)
  @klass = klass
  @loaded_countries = {}
end

def load(country_code)

def load(country_code)
  if (data = from_cache(country_code))
    data
  else
    @loaded_countries[country_code] = klass.load(country_code)
  end
end

def save(country_code, data)

def save(country_code, data)
  klass.new(country_code).save(data)
end