Project

thailand

0.01
No commit activity in last 3 years
No release in over 3 years
Provinces, districts and subdistricts of Thailand
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.9
~> 0.8
~> 10.0
~> 3.2
~> 0.10

Runtime

 Project Readme

Gem Version Dependency Status Build Status Coverage Status Code Climate

Thailand

Provinces, districts and subdistricts of Thailand

Installation

Add this line to your application's Gemfile:

gem 'thailand'

And then execute:

$ bundle

Or install it yourself as:

$ gem install thailand

Usage

require 'thailand'
include Thailand

thailand = Country.instance
=> #<Thailand::Country name: "Thailand", official_name: "Kingdom of Thailand">
thailand.name
=> "Thailand"
thailand.official_name
=> "Kingdom of Thailand"
thailand.subregions?      # or use changwat? instead of subregions?
=> true
thailand.subregions.size  # or use changwat instead of subregions
=> 77

bangkok = Province.named 'Bangkok'
=> #<Thailand::Province name: "Bangkok">
bangkok.subregions?       # or use amphoe? or khet? instead of subregions?
=> true
bangkok.subregions.size   # or use amphoe or khet instead of subregions
=> 50

district = District.coded '1001'
=> #<Thailand::District name: "Phra Nakhon">
district.name
=> "Phra Nakhon"
district.subregions?      # or use tambon? or khwaeng? instead of subregions?
=> true
district.subregions.size  # or use tambon or khwaeng instead of subregions
=> 12

subdistrict = district.subregions.first
=> #<Thailand::Region name: "Phra Borom Maha Ratchawang">
subdistrict.name
=> "Phra Borom Maha Ratchawang"

Thailand.i18n_backend.locale = :th
thailand = Country.instance
thailand.name
=> "\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28\u0E44\u0E17\u0E22"

Contributing

  1. Fork it ( https://github.com/kiterminal/thailand/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request