class Sources::Local::Subdivision

Auxiliary Subdivision class to support loading the local subdivision data to be updated with Unicode CLDR data

def self.load(code)

def self.load(code)
  new(code).load
end

def file_path

def file_path
  "lib/countries/data/subdivisions/#{code}.yaml"
end

def initialize(code)

def initialize(code)
  @code = code
end

def load

def load
  if File.exist?(file_path)
    YAML.load_file(file_path) || {}
  else
    {}
  end
end

def save(data)

def save(data)
  File.write(file_path, data.to_yaml)
rescue StandardError
  puts "failed to read #{file}: #{$ERROR_INFO}"
end