class Country

def self.[](query)

def self.[](query)
  self.search(query)
end

def self.search(query)

def self.search(query)
  Country.new(Data[query])
end

def initialize(data)

def initialize(data)
  @number = data['number']
  @alpha2 = data['alpha2']
  @alpha3 = data['alpha3']
  @name = data['name']
  @names = data['names']
  @latitude = data['latitude']
  @longitude = data['longitude']
  @region = data['region']
  @subregion = data['subregion']
  
  @country_code = data['e164_country_code']
  @national_destination_code_lengths = data['e164_national_destination_code_lengths']
  @national_number_lengths = data['e164_national_number_lengths']
  @international_prefix = data['e164_international_prefix']
  @national_prefix = data['e164_national_prefix']
end

def subdivisions

def subdivisions
  @subdivisions ||= subdivisions? ? YAML.load_file(File.join(File.dirname(__FILE__), 'data', 'subdivisions', "#{alpha2}.yaml")) : {}
end

def subdivisions?

def subdivisions?
  File.exist?(File.join(File.dirname(__FILE__), 'data', 'subdivisions', "#{alpha2}.yaml"))
end