module ListOfCountries

Constants

VERSION

Public Class Methods

cities() click to toggle source
# File lib/list_of_countries.rb, line 30
def self.cities
  @cities ||= begin
    path = File.expand_path("../../data/countries_states_cities_database/cities.json", __FILE__)
    file = File.open(path, "r")
    JSON.load(file).map do |data|
      City.new(data)
    end.freeze
  end
end
countries() click to toggle source
# File lib/list_of_countries.rb, line 10
def self.countries
  @countries ||= begin
    path = File.expand_path("../../data/countries/countries.json", __FILE__)
    file = File.open(path, "r")
    JSON.load(file).map do |data|
      Country.new(data)
    end.freeze
  end
end
states() click to toggle source
# File lib/list_of_countries.rb, line 20
def self.states
  @states ||= begin
    path = File.expand_path("../../data/countries_states_cities_database/states.json", __FILE__)
    file = File.open(path, "r")
    JSON.load(file).map do |data|
      State.new(data)
    end.freeze
  end
end