KeCounties is a tiny gem that provides the full list of Kenya county names, their codes, abbreviations and provinces(used popuraly used regions previously before the counties' formation).
In a Gemfile:
gem 'ke_counties'
Globally in your machine:
gem install 'ke_counties'
You can get all the county names with
KeCounties.names
Get all county codes
KeCounties.codes
To get the whole hash mapping each county name to its code, abbreviation, province and capital ; use
KeCounties.all
Other methods provides are .code, .abbr, .capital, .province which returns the code, abbreviation, capital and province respectively if passed in a capitalized county name. E.g
KeCounties.code('Nakuru') # returns '032'
KeCounties.province('Nakuru') # returns 'Rift Valley'
List of counties can be found in this gist
- Run
rspecto run tests - To install this gem locally on your machine, run
bundle exec rake install. - To release a new version, update the version number in
lib/version.rb, and then runbundle exec rake release, which will create a git tag for the version. Push your commits and tags and push the gemspec file to rubygems.org - Then commit and make a PR to update the code on this repository
Bugs reports and pull requests are welcome at https://github.com/cesswairimu/ke_counties
RubyGems - https://rubygems.org/gems/ke_counties