Module: Urbans
- Defined in:
- lib/urbans.rb,
lib/urbans/version.rb
Defined Under Namespace
Classes: City, Configurer, Country, Error, Province
Constant Summary collapse
- URBAN_PATH =
File.(File.dirname(__FILE__)) + "/"
- ALL_COUNTRIES =
all avalable countries supported by Urbans
[:id]
- ALL_LOCALES =
all available locales
[:id, :en]
- 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
{}
- CITIES =
similar to above
{}
- VERSION =
"0.1.0"
- @@default_locale =
nil
Class Method Summary collapse
- .city ⇒ Object
- .config(&block) ⇒ Object
- .country ⇒ Object
- .locale ⇒ Object
- .locale=(locale) ⇒ Object
- .province ⇒ Object
Class Method Details
.config(&block) ⇒ Object
44 45 46 |
# File 'lib/urbans.rb', line 44 def config(&block) Urbans::Configurer.new.instance_eval(&block) end |
.locale ⇒ Object
56 57 58 59 |
# 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) ⇒ Object
48 49 50 51 52 53 54 |
# 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 |