ke_counties 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a23ca5515924858c355789d65540fbbaba3a30368609861cca6a9de2c995dcc9
4
- data.tar.gz: c3f99fc697e4484f038885b4e94c17b2a38cdd3580ff0d51d98a1e61812fbddb
3
+ metadata.gz: eeecb8d2997b490e19aa4e11b7e3fd7fa616f9a954650ee3d123f71b530c9257
4
+ data.tar.gz: 3691770a5e074d572fcac4c686fec8a3c0d7a73bf8b3d02d3ca65e2e0a196ad0
5
5
  SHA512:
6
- metadata.gz: e7e2c4ab68d6968c500bf44ca7ddc956ff8f0e5737e42f58341088d31b38a8e7beb37727ea28e1d940bc9e790c31ea4477e1473511538085c20bae7ff8bfbb73
7
- data.tar.gz: e2dfc0c2842f3c2edc6609b004d27bc7bfe60ae07e206776493842715c6e803e5bf8b11a55e0f8cfb61f763a9f31d3ca6807b58af01d5ae5d06e7487cd76eeea
6
+ metadata.gz: c52af155aa92e0ae64d832f0a2726c8d2e9ef42d3439361e181b7cd23c982a9631eb575de1d41f047761b6456994c43c10d47767ec1eaa84222c6c95ba33c19c
7
+ data.tar.gz: 83c58e77b30c50671c3e83171d9ad427f09aaa99ba213754a95f33102fc445bf87cf71443479857a50c363398ba153c3c413ee89c7b62fc0f75c368625493533
data/README.md CHANGED
@@ -1 +1,58 @@
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
57
+
58
+ RubyGems - https://rubygems.org/gems/ke_counties
data/ke_counties.gemspec CHANGED
@@ -6,13 +6,17 @@ 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
- #s.files = ["lib/ke_counties.rb"]
13
12
  s.homepage = 'https://github.com/cesswairimu/ke_counties'
14
13
  s.license = 'MIT'
15
- s.files = `git ls-files -z`.split("\x0").reject do |f|
14
+ s.metadata = {
15
+ 'bug_tracker_uri' => 'https://github.com/cesswairimu/ke_counties/issues',
16
+ 'documentation_uri' => 'https://github.com/cesswairimu/ke_counties/blob/main/README.md',
17
+ 'source_code_uri' => 'https://github.com/cesswairimu/ke_counties/',
18
+ }
19
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
16
20
  f.match(%r{^(test|spec|features)/})
17
21
  end
18
22
 
@@ -21,7 +25,7 @@ Gem::Specification.new do |s|
21
25
  s.require_paths = ['lib']
22
26
 
23
27
  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'
28
+ s.add_development_dependency 'rake', '~> 13.2.0'
29
+ s.add_development_dependency 'bundler', '~> 2.5.7'
26
30
  end
27
31
 
@@ -49,32 +49,8 @@ module KeCounties
49
49
  'Nairobi' => { code: '047', abbrv: 'NRB', capital: 'Nairobi', province: 'Nairobi' }
50
50
  }.freeze
51
51
 
52
- def self.all
52
+ def self.counties_hash
53
53
  HASH
54
54
  end
55
-
56
- def self.names
57
- HASH.keys
58
- end
59
-
60
- def self.code(cty)
61
- HASH[cty][:code]
62
- end
63
-
64
- def self.abbr(cty)
65
- HASH[cty][:abbrv]
66
- end
67
-
68
- def self.capital(cty)
69
- HASH[cty][:capital]
70
- end
71
-
72
- def self.province(cty)
73
- HASH[cty][:province]
74
- end
75
-
76
- def self.content
77
- HASH.values
78
- end
79
55
  end
80
56
  end
@@ -1,3 +1,3 @@
1
1
  module KeCounties
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/ke_counties.rb CHANGED
@@ -1,46 +1,49 @@
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
8
- counties.all
6
+
7
+ def all
8
+ counties
9
9
  end
10
10
 
11
11
  def names
12
- counties.names
12
+ counties.keys
13
13
  end
14
14
 
15
15
  def code(cty)
16
- counties.code(cty)
16
+ counties.dig(cty, :code)
17
17
  end
18
18
 
19
19
  def abbr(cty)
20
- counties.abbr(cty)
20
+ counties.dig(cty, :abbrv)
21
21
  end
22
22
 
23
23
  def capital(cty)
24
- counties.capital(cty)
24
+ counties.dig(cty, :capital)
25
25
  end
26
26
 
27
27
  def province(cty)
28
- counties.province(cty)
28
+ counties.dig(cty, :province)
29
29
  end
30
30
 
31
31
  def codes
32
- counties.content.map{ |i| i[:code]}
32
+ content.map{ |i| i[:code]}
33
33
  end
34
34
 
35
35
  def abbrvs
36
- counties.content.map{ |i| i[:abbrv]}
36
+ content.map{ |i| i[:abbrv]}
37
37
  end
38
38
 
39
+ def content
40
+ counties.values
41
+ end
39
42
 
40
43
  private
41
44
 
42
45
  def counties
43
- KeCounties::Counties
46
+ KeCounties::Counties.counties_hash
44
47
  end
45
- end
46
- end
48
+ end
49
+ 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.3
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-04 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: []
@@ -72,7 +73,10 @@ files:
72
73
  homepage: https://github.com/cesswairimu/ke_counties
73
74
  licenses:
74
75
  - MIT
75
- metadata: {}
76
+ metadata:
77
+ bug_tracker_uri: https://github.com/cesswairimu/ke_counties/issues
78
+ documentation_uri: https://github.com/cesswairimu/ke_counties/blob/main/README.md
79
+ source_code_uri: https://github.com/cesswairimu/ke_counties/
76
80
  post_install_message:
77
81
  rdoc_options: []
78
82
  require_paths:
@@ -88,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
92
  - !ruby/object:Gem::Version
89
93
  version: '0'
90
94
  requirements: []
91
- rubygems_version: 3.5.3
95
+ rubygems_version: 3.3.5
92
96
  signing_key:
93
97
  specification_version: 4
94
98
  summary: Kenya Counties