ke_counties 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a23ca5515924858c355789d65540fbbaba3a30368609861cca6a9de2c995dcc9
4
- data.tar.gz: c3f99fc697e4484f038885b4e94c17b2a38cdd3580ff0d51d98a1e61812fbddb
3
+ metadata.gz: cf99fa284a462a4a183fee4c1e3c44ed17818369d8ae108cc36d99c7f2ced9b1
4
+ data.tar.gz: 1d955b1c1955202ece741df81f59dc3842b35b15858af45736119313b0dce3e5
5
5
  SHA512:
6
- metadata.gz: e7e2c4ab68d6968c500bf44ca7ddc956ff8f0e5737e42f58341088d31b38a8e7beb37727ea28e1d940bc9e790c31ea4477e1473511538085c20bae7ff8bfbb73
7
- data.tar.gz: e2dfc0c2842f3c2edc6609b004d27bc7bfe60ae07e206776493842715c6e803e5bf8b11a55e0f8cfb61f763a9f31d3ca6807b58af01d5ae5d06e7487cd76eeea
6
+ metadata.gz: 8965f478c15541c531299ef11f0242bdebfaa59fa75f3e3dfcfceab0aea287e05ca0f20bfb77a94e5a109aa9c884f57327a5a9b04865826c1fc93529a54c5859
7
+ data.tar.gz: ede6c85e6c5ddfb0134c17a5efb5a7da4a858aba8c85b87161ae7436d529c1e853ec3086ad930c06219b141c92cda493ced0336b157d724584341468f2a2a35c
data/README.md CHANGED
@@ -1 +1,56 @@
1
- # KE COUNTIES
1
+ ## KE COUNTIES
2
+
3
+ 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).
4
+
5
+ ### Installation
6
+
7
+ In a Gemfile:
8
+
9
+ ```
10
+ gem 'ke_counties'
11
+ ```
12
+
13
+ Globally in your machine:
14
+
15
+ ```
16
+ gem install 'ke_counties'
17
+ ```
18
+
19
+ ### Usage
20
+
21
+ You can get all the county names with
22
+
23
+ ```
24
+ KeCounties.names
25
+ ```
26
+
27
+ Get all county codes
28
+
29
+ ```
30
+ KeCounties.codes
31
+ ```
32
+ To get the whole hash mapping each county name to its code, abbreviation, province and capital ; use
33
+
34
+ ```
35
+ KeCounties.all
36
+ ```
37
+
38
+ 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
39
+
40
+ ```
41
+ KeCounties.code('Nakuru') # returns '032'
42
+
43
+ KeCounties.province('Nakuru') # returns 'Rift Valley'
44
+ ```
45
+ List of counties can be found in this [gist](https://gist.github.com/cesswairimu/56902588ed732b1abae2d7372e01f8fc)
46
+
47
+ ### Development
48
+
49
+ - Run `rspec` to run tests
50
+ - To install this gem locally on your machine, run `bundle exec rake install`.
51
+ - To release a new version, update the version number in `lib/version.rb`, and then run `bundle 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
52
+ - Then commit and make a PR to update the code on this repository
53
+
54
+ ### Contributing
55
+
56
+ Bugs reports and pull requests are welcome at https://github.com/cesswairimu/ke_counties
data/ke_counties.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = 'ke_counties'
7
7
  s.version = KeCounties::VERSION
8
8
  s.summary = 'Kenya Counties'
9
- s.description = 'Collection of county codes, their names, capitals and provinces'
9
+ s.description = 'Collection of Kenya county names, their codes, capitals, abbreviations and provinces'
10
10
  s.authors = ['cess']
11
11
  s.email = 'cesswairimu@gmail.com'
12
12
  #s.files = ["lib/ke_counties.rb"]
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.require_paths = ['lib']
22
22
 
23
23
  s.add_development_dependency 'rspec', '~> 3.13.0'
24
- s.add_development_dependency 'rake', '~> 12.3.3'
25
- s.add_development_dependency 'bundler', '~> 13.1.0'
24
+ s.add_development_dependency 'rake', '~> 13.2.0'
25
+ s.add_development_dependency 'bundler', '~> 2.5.7'
26
26
  end
27
27
 
@@ -58,19 +58,19 @@ module KeCounties
58
58
  end
59
59
 
60
60
  def self.code(cty)
61
- HASH[cty][:code]
61
+ HASH.dig(cty, :code)
62
62
  end
63
63
 
64
64
  def self.abbr(cty)
65
- HASH[cty][:abbrv]
65
+ HASH.dig(cty, :abbrv)
66
66
  end
67
67
 
68
68
  def self.capital(cty)
69
- HASH[cty][:capital]
69
+ HASH.dig(cty, :capital)
70
70
  end
71
71
 
72
72
  def self.province(cty)
73
- HASH[cty][:province]
73
+ HASH.dig(cty, :province)
74
74
  end
75
75
 
76
76
  def self.content
@@ -1,3 +1,3 @@
1
1
  module KeCounties
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/ke_counties.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require_relative 'ke_counties/version'
2
2
  require_relative 'ke_counties/counties'
3
3
 
4
- module KeCounties
4
+ module KeCounties
5
5
  class << self
6
-
7
- def all
6
+
7
+ def all
8
8
  counties.all
9
9
  end
10
10
 
@@ -36,11 +36,10 @@ module KeCounties
36
36
  counties.content.map{ |i| i[:abbrv]}
37
37
  end
38
38
 
39
-
40
39
  private
41
40
 
42
41
  def counties
43
42
  KeCounties::Counties
44
43
  end
45
- end
46
- end
44
+ end
45
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ke_counties
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - cess
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-28 00:00:00.000000000 Z
11
+ date: 2024-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -30,29 +30,30 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 12.3.3
33
+ version: 13.2.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 12.3.3
40
+ version: 13.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 13.1.0
47
+ version: 2.5.7
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 13.1.0
55
- description: Collection of county codes, their names, capitals and provinces
54
+ version: 2.5.7
55
+ description: Collection of Kenya county names, their codes, capitals, abbreviations
56
+ and provinces
56
57
  email: cesswairimu@gmail.com
57
58
  executables: []
58
59
  extensions: []