Sha256: dbac28e23440f3b38fbad0cd4507fe2339b9d56bdfa4041f7888e8a2ef53e9e5
Contents?: true
Size: 557 Bytes
Versions: 12
Compression:
Stored size: 557 Bytes
Contents
module Sources module Local class CachedLoader attr_reader :klass def initialize(klass) @klass = klass @loaded_countries = {} end def from_cache(country_code) @loaded_countries[country_code] end 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) klass.new(country_code).save(data) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems