module ISO3166::CountryClassMethods
def cached(value)
file or our own code, caching user-generated data could be dangerous
NB: We only want to use this cache for values coming from the JSON
creation of new String object instances.
variable. This will make subsequent parses O(1) and will stop the
object creations and save the GC, we can cache them in an class instance
create a large number of objects internally. In order to reduce the
Some methods like parse_value are expensive in that they
def cached(value) @_parsed_values_cache ||= {} return @_parsed_values_cache[value] if @_parsed_values_cache[value] @_parsed_values_cache[value] = yield end