module Urbans

Constants

ALL_COUNTRIES

all avalable countries supported by Urbans

ALL_LOCALES

all available locales

CITIES

similar to above

COUNTRIES

mapping of countries and locales, eg: {

id: {en: Indonesia, id: Indonesia}

} only load locale when necessary

PROVINCES

mapping of provinces and locales, eg: {

id_pv_ach: {en: "Aceh", id: "Aceh"}

} only load locale when necessary

URBAN_PATH
VERSION

Public Instance Methods

city() click to toggle source
# File lib/urbans.rb, line 69
def city
  Urbans::City
end
config(&block) click to toggle source
# File lib/urbans.rb, line 44
def config(&block)
  Urbans::Configurer.new.instance_eval(&block)
end
country() click to toggle source
# File lib/urbans.rb, line 61
def country
  Urbans::Country
end
locale() click to toggle source
# File lib/urbans.rb, line 56
def locale
  raise Urbans::Error, "Locale have not been set yet" if @@default_locale.nil?
  @@default_locale
end
locale=(locale) click to toggle source
# File lib/urbans.rb, line 48
def locale=(locale)
  if ALL_LOCALES.include?(locale.to_sym)
    @@default_locale = locale.to_sym
  else
    raise Urbans::Error, "Unsupported locale: #{locale}."
  end
end
province() click to toggle source
# File lib/urbans.rb, line 65
def province
  Urbans::Province
end