nayyar 0.1.1 → 0.1.2
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 +5 -5
- data/.circleci/config.yml +35 -0
- data/.rubocop.yml +10 -0
- data/Gemfile +2 -0
- data/README.md +102 -16
- data/Rakefile +4 -2
- data/bin/console +4 -3
- data/lib/data/extract.rb +13 -8
- data/lib/nayyar/district.rb +127 -120
- data/lib/nayyar/state.rb +98 -95
- data/lib/nayyar/township.rb +123 -117
- data/lib/nayyar/version.rb +3 -1
- data/lib/nayyar.rb +9 -5
- data/nayyar.gemspec +24 -20
- metadata +54 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8877dd83a8a2ba5c4efc6ce025c6afc79e072d2361008d02e2cc4eebad49c027
|
|
4
|
+
data.tar.gz: dd7f9602d9cb86f1447017101f014b5c652d47b71e7394363260a476b3d33ccd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ac406af5aab9869fcaeb709c8a08f25105b62c8ba1528b0ef836b15ba4c923d629e2431a970b761ae552ecd32f5ae41e69dfbad557e340eaf6e02257017c8ee
|
|
7
|
+
data.tar.gz: df07064162e9a98507b12a075b5ae17cd690453587bd20c2bd08107fcf7730483de97e52a7b79cd189ae36a911b9187c7ab31e700377e6b76b1442f25b0c07a3
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Use the latest 2.1 version of CircleCI pipeline process engine.
|
|
2
|
+
# See: https://circleci.com/docs/2.0/configuration-reference
|
|
3
|
+
version: 2.1
|
|
4
|
+
|
|
5
|
+
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
|
|
6
|
+
# See: https://circleci.com/docs/2.0/orb-intro/
|
|
7
|
+
orbs:
|
|
8
|
+
ruby: circleci/ruby@1.4.0
|
|
9
|
+
|
|
10
|
+
# Define a job to be invoked later in a workflow.
|
|
11
|
+
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
|
|
12
|
+
jobs:
|
|
13
|
+
rspec:
|
|
14
|
+
docker:
|
|
15
|
+
- image: cimg/ruby:3.1.0
|
|
16
|
+
executor: ruby/default
|
|
17
|
+
steps:
|
|
18
|
+
- checkout
|
|
19
|
+
- run:
|
|
20
|
+
name: Which bundler?
|
|
21
|
+
command: bundle -v
|
|
22
|
+
- run:
|
|
23
|
+
name: bundle install
|
|
24
|
+
command: bundle install
|
|
25
|
+
- run:
|
|
26
|
+
name: rspec
|
|
27
|
+
command: rspec
|
|
28
|
+
|
|
29
|
+
# Invoke jobs via workflows
|
|
30
|
+
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
|
|
31
|
+
workflows:
|
|
32
|
+
rspec: # This is the name of the workflow, feel free to change it to better match your workflow.
|
|
33
|
+
# Inside the workflow, you define the jobs you want to run.
|
|
34
|
+
jobs:
|
|
35
|
+
- rspec
|
data/.rubocop.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# Nayyar / နေရာ
|
|
2
|
-
[](http://badge.fury.io/rb/nayyar)
|
|
2
|
+
[](https://circleci.com/gh/mmhan/nayyar/tree/master)
|
|
4
3
|
|
|
5
4
|
Nayyar is created with the intent of providing basic access to State/Regions, Districts or Townships of Myanmar, based on standards of Myanmar's country-wide census of 2014.
|
|
6
5
|
|
|
7
6
|
15 States are indexed by MIMU's pcode, ISO3166-2:MM and alpha3 codes used in plate numbers by transportation authority.
|
|
8
7
|
74 Districts and 413 Townships are indexed by MIMU's pcode.
|
|
9
8
|
|
|
10
|
-
The current version is
|
|
9
|
+
The current version is [](http://badge.fury.io/rb/nayyar) and it uses [Semantic Versioning](http://semver.org/)
|
|
11
10
|
|
|
12
11
|
## Installation
|
|
13
12
|
|
|
@@ -134,29 +133,20 @@ Nayyar::Township.find_by(pcode:"MMR013017")
|
|
|
134
133
|
Find the district that a township belongs to using
|
|
135
134
|
|
|
136
135
|
```ruby
|
|
137
|
-
Nayyar::Township.find_by(pcode:"MMR013017").
|
|
136
|
+
Nayyar::Township.find_by(pcode:"MMR013017").district
|
|
138
137
|
|
|
139
138
|
# => <Nayyar::District:0x007fb8a5ad14d8 @data={:pcode=>"MMR013D002", :name=>"Yangon (East)", :state=>"MMR013"}>
|
|
140
139
|
```
|
|
141
140
|
|
|
142
141
|
Use any of the `find_by` or `find_by_**index_name**` with a bang `!` to trigger `Nayyar::TownshipNotFound` error.
|
|
143
|
-
|
|
142
|
+
|
|
144
143
|
## Development
|
|
145
144
|
|
|
146
145
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
147
146
|
|
|
148
147
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
149
|
-
-->
|
|
150
|
-
|
|
151
|
-
## Goals
|
|
152
|
-
1. Make it work
|
|
153
|
-
- Create just enough API to allow creations of dropdowns/multiple-select options in HTML ✓
|
|
154
|
-
2. Make it right
|
|
155
|
-
- Remove duplicate/similar codes across the three main classes using metaprogramming
|
|
156
|
-
3. Make it fast
|
|
157
|
-
- Optimize memory footprint by refactoring the way data is stored/read/used
|
|
158
148
|
|
|
159
|
-
If you feel that I have missed out your use-case or
|
|
149
|
+
If you feel that I have missed out your use-case or find an issue with this gem [please submit an issue](https://github.com/mmhan/nayyar/issues/new).
|
|
160
150
|
|
|
161
151
|
## Contributing
|
|
162
152
|
|
|
@@ -164,4 +154,100 @@ If you feel that I have missed out your use-case or if you wanna add other goals
|
|
|
164
154
|
2. Create your feature branch (`git checkout -b feature/my-new-feature`)
|
|
165
155
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
166
156
|
4. Push to the branch (`git push origin feature/my-new-feature`)
|
|
167
|
-
5. Create a new Pull Request
|
|
157
|
+
5. Create a new Pull Request
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## Documentation
|
|
161
|
+
|
|
162
|
+
Since, this is a pretty small library, a documentation hasn't been created yet. Nonetheless, here's the rspec output with documentation format.
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Nayyar
|
|
166
|
+
has a version number
|
|
167
|
+
|
|
168
|
+
Nayyar::State
|
|
169
|
+
class methods
|
|
170
|
+
.all
|
|
171
|
+
should be a kind of Array
|
|
172
|
+
contains hashes of state data
|
|
173
|
+
.find_by
|
|
174
|
+
returns state when it finds it
|
|
175
|
+
will return nil if state is not found
|
|
176
|
+
will raise ArgumentError if no argument is provided
|
|
177
|
+
will raise ArgumentError if wrong argument is provided
|
|
178
|
+
.find_by!
|
|
179
|
+
should be a kind of Nayyar::State
|
|
180
|
+
will raise error if the state isn't found
|
|
181
|
+
.find_by_**indices**
|
|
182
|
+
returns state when it finds it
|
|
183
|
+
returns nil when it can't be found
|
|
184
|
+
.find_by_**indices**!
|
|
185
|
+
returns state when it finds it
|
|
186
|
+
raise error when it can't be found
|
|
187
|
+
#initialize
|
|
188
|
+
allows to create a state by providing hash data
|
|
189
|
+
attributes
|
|
190
|
+
allows its attributes to be accessed by methods
|
|
191
|
+
allows its attributes to be accessed as keys
|
|
192
|
+
#districts
|
|
193
|
+
return a list of districts under given state
|
|
194
|
+
|
|
195
|
+
Nayyar::District
|
|
196
|
+
class methods
|
|
197
|
+
.all
|
|
198
|
+
should return all districts
|
|
199
|
+
.of_state
|
|
200
|
+
return a list of districts under given state
|
|
201
|
+
.find_by
|
|
202
|
+
should be a kind of Nayyar::District
|
|
203
|
+
returns nil if it's not found
|
|
204
|
+
.find_by!
|
|
205
|
+
should be a kind of Nayyar::District
|
|
206
|
+
raise error if it's not found
|
|
207
|
+
.find_by_**indices**
|
|
208
|
+
returns state when it finds it
|
|
209
|
+
returns nil when it can't be found
|
|
210
|
+
.find_by_**indices**!
|
|
211
|
+
returns state when it finds it
|
|
212
|
+
raise error when it can't be found
|
|
213
|
+
#initialize
|
|
214
|
+
allows to create a district by providing hash data
|
|
215
|
+
attributes
|
|
216
|
+
allows its attributes to be accessed by methods
|
|
217
|
+
allows its attributes to be accessed as keys
|
|
218
|
+
#state
|
|
219
|
+
should be a kind of Nayyar::State
|
|
220
|
+
expect it to be a correct state
|
|
221
|
+
.townships
|
|
222
|
+
return a list of districts under given district
|
|
223
|
+
|
|
224
|
+
Nayyar::Township
|
|
225
|
+
class methods
|
|
226
|
+
.all
|
|
227
|
+
should return all township
|
|
228
|
+
.of_district
|
|
229
|
+
return a list of districts under given district
|
|
230
|
+
.find_by
|
|
231
|
+
should be a kind of Nayyar::Township
|
|
232
|
+
returns nil if it's not found
|
|
233
|
+
.find_by!
|
|
234
|
+
should be a kind of Nayyar::Township
|
|
235
|
+
raise error if it's not found
|
|
236
|
+
.find_by_**indices**
|
|
237
|
+
returns state when it finds it
|
|
238
|
+
returns nil when it can't be found
|
|
239
|
+
.find_by_**indices**!
|
|
240
|
+
returns state when it finds it
|
|
241
|
+
raise error when it can't be found
|
|
242
|
+
#initialize
|
|
243
|
+
allows to create a township by providing hash data
|
|
244
|
+
attributes
|
|
245
|
+
allows its attributes to be accessed by methods
|
|
246
|
+
allows its attributes to be accessed as keys
|
|
247
|
+
#district
|
|
248
|
+
should be a kind of Nayyar::District
|
|
249
|
+
expect it to be a correct state
|
|
250
|
+
|
|
251
|
+
Finished in 0.1254 seconds (files took 0.1826 seconds to load)
|
|
252
|
+
48 examples, 0 failures
|
|
253
|
+
```
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'nayyar'
|
|
5
6
|
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
|
@@ -10,5 +11,5 @@ require "nayyar"
|
|
|
10
11
|
# require "pry"
|
|
11
12
|
# Pry.start
|
|
12
13
|
|
|
13
|
-
require
|
|
14
|
+
require 'irb'
|
|
14
15
|
IRB.start
|
data/lib/data/extract.rb
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Extract data from locations.csv which will be the source of data for the gem
|
|
4
|
+
# and create states.yml, districts.yml and townships.yml which will be read at runtime
|
|
5
|
+
|
|
1
6
|
require 'csv'
|
|
2
7
|
require 'pry'
|
|
3
8
|
require 'psych'
|
|
@@ -6,14 +11,14 @@ states = []
|
|
|
6
11
|
districts = []
|
|
7
12
|
townships = []
|
|
8
13
|
|
|
9
|
-
CSV.foreach(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
CSV.foreach('locations.csv') do |iso, s_pcode, alpha3, state, d_pcode, district, t_pcode, township| # rubocop:disable Metrics/ParameterLists
|
|
15
|
+
states << { iso: iso, pcode: s_pcode, alpha3: alpha3, name: state }
|
|
16
|
+
districts << { pcode: d_pcode, name: district, state: s_pcode } unless d_pcode.nil?
|
|
17
|
+
townships << { pcode: t_pcode, name: township, district: d_pcode } unless t_pcode.nil?
|
|
13
18
|
end
|
|
14
19
|
states.uniq! { |state| state[:pcode] }
|
|
15
|
-
districts.uniq! { |
|
|
20
|
+
districts.uniq! { |district| district[:pcode] }
|
|
16
21
|
|
|
17
|
-
File.
|
|
18
|
-
File.
|
|
19
|
-
File.
|
|
22
|
+
File.write('states.yml', states.to_yaml)
|
|
23
|
+
File.write('districts.yml', districts.to_yaml)
|
|
24
|
+
File.write('townships.yml', townships.to_yaml)
|
data/lib/nayyar/district.rb
CHANGED
|
@@ -1,122 +1,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Represents a District in Myanmar
|
|
1
4
|
class Nayyar::District
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
5
|
+
attr_reader :data
|
|
6
|
+
|
|
7
|
+
@districts = nil
|
|
8
|
+
@state_index = {}
|
|
9
|
+
|
|
10
|
+
ATTRIBUTES = %i[
|
|
11
|
+
pcode
|
|
12
|
+
name
|
|
13
|
+
].freeze
|
|
14
|
+
|
|
15
|
+
INDICES = %w[pcode].freeze
|
|
16
|
+
|
|
17
|
+
def initialize(data)
|
|
18
|
+
@data = data
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# define getters
|
|
22
|
+
ATTRIBUTES.each do |attr|
|
|
23
|
+
define_method attr do
|
|
24
|
+
@data[attr]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# allow the values to be retrieved as an array
|
|
29
|
+
def [](key)
|
|
30
|
+
if ATTRIBUTES.include? key
|
|
31
|
+
@data[key]
|
|
32
|
+
elsif key.to_sym == :state
|
|
33
|
+
state
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def state
|
|
38
|
+
Nayyar::State.find_by_pcode(@data[:state])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def townships
|
|
42
|
+
Nayyar::Township.of_district(self)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class << self
|
|
46
|
+
def all
|
|
47
|
+
districts
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def of_state(state)
|
|
51
|
+
state_pcode = state.pcode
|
|
52
|
+
districts = self.districts
|
|
53
|
+
@state_index[state_pcode].map do |index|
|
|
54
|
+
districts[index]
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def find_by(query)
|
|
59
|
+
key = get_key(query)
|
|
60
|
+
(index = send("#{key}_index".to_sym).index(query[key])) && districts[index]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def find_by!(query)
|
|
64
|
+
if (district = find_by(query))
|
|
65
|
+
district
|
|
66
|
+
else
|
|
67
|
+
key = get_key(query)
|
|
68
|
+
raise Nayyar::DistrictNotFound, "Cannot find State with given #{key}: #{query[key]}"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
INDICES.each do |index|
|
|
73
|
+
define_method("find_by_#{index}") do |query|
|
|
74
|
+
find_by(index.to_sym => query)
|
|
75
|
+
end
|
|
76
|
+
define_method("find_by_#{index}!") do |query|
|
|
77
|
+
find_by!(index.to_sym => query)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
protected
|
|
82
|
+
|
|
83
|
+
def districts
|
|
84
|
+
unless @districts
|
|
85
|
+
indices = INDICES.inject({}) { |memo, index| memo.merge index => [] }
|
|
86
|
+
@districts = data.each_with_index.map do |district_data, i|
|
|
87
|
+
new(district_data).tap { |district| build_indices(indices, district, district_data[:state], i) }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
INDICES.each do |index|
|
|
91
|
+
class_variable_set("@@#{index}_index", indices[index]) # rubocop:disable Style/ClassVars
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
@districts
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def data
|
|
98
|
+
YAML.load_file(File.join(File.dirname(__FILE__), '..', 'data', 'districts.yml'))
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def build_indices(indices, district, state_pcode, reference_index)
|
|
102
|
+
INDICES.each do |index|
|
|
103
|
+
indices[index] << district.send(index)
|
|
104
|
+
end
|
|
105
|
+
@state_index[state_pcode] ||= []
|
|
106
|
+
@state_index[state_pcode] << reference_index
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
## define private methods for internal use of indexed array
|
|
110
|
+
INDICES.each do |index|
|
|
111
|
+
define_method("#{index}_index") do
|
|
112
|
+
districts
|
|
113
|
+
class_variable_get("@@#{index}_index")
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
## return the index for query given to find_by/find_by! method
|
|
118
|
+
def get_key(data)
|
|
119
|
+
keys = data.keys
|
|
120
|
+
if keys.length != 1 || INDICES.none? { |key| key.to_sym == keys.first.to_sym }
|
|
121
|
+
raise ArgumentError, "`find_by` accepts only one of #{INDICES.join(' or ')} as argument. none provided"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
keys.first
|
|
125
|
+
end
|
|
126
|
+
end
|
|
121
127
|
end
|
|
122
|
-
|
|
128
|
+
|
|
129
|
+
class Nayyar::DistrictNotFound < StandardError; end
|
data/lib/nayyar/state.rb
CHANGED
|
@@ -1,107 +1,110 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Represents a State in Myanmar
|
|
1
4
|
class Nayyar::State
|
|
2
|
-
|
|
5
|
+
attr_reader :data
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
@states = nil
|
|
8
|
+
@pcode_index = []
|
|
9
|
+
@iso_index = []
|
|
10
|
+
@alpha3_index = []
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
ATTRIBUTES = %i[
|
|
13
|
+
pcode
|
|
14
|
+
iso
|
|
15
|
+
alpha3
|
|
16
|
+
name
|
|
17
|
+
].freeze
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
@data = data
|
|
18
|
-
end
|
|
19
|
+
INDICES = %w[pcode iso alpha3].freeze
|
|
19
20
|
|
|
21
|
+
def initialize(data)
|
|
22
|
+
@data = data
|
|
23
|
+
end
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
# define getters
|
|
26
|
+
ATTRIBUTES.each do |attr|
|
|
27
|
+
define_method attr do
|
|
28
|
+
@data[attr]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
# allow the values to be retrieved as an array
|
|
33
|
+
def [](key)
|
|
34
|
+
@data[key]
|
|
35
|
+
end
|
|
32
36
|
|
|
33
37
|
def districts
|
|
34
|
-
|
|
38
|
+
Nayyar::District.of_state self
|
|
35
39
|
end
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
end
|
|
105
|
-
end
|
|
41
|
+
class << self
|
|
42
|
+
def all
|
|
43
|
+
states
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def find_by(query)
|
|
47
|
+
key = get_key(query)
|
|
48
|
+
(index = send("#{key}_index".to_sym).index(query[key])) && states[index]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def find_by!(query)
|
|
52
|
+
if (state = find_by(query))
|
|
53
|
+
state
|
|
54
|
+
else
|
|
55
|
+
key = get_key(query)
|
|
56
|
+
raise Nayyar::StateNotFound, "Cannot find State with given #{key}: #{query[key]}"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
INDICES.each do |index|
|
|
61
|
+
define_method("find_by_#{index}") do |query|
|
|
62
|
+
find_by(index.to_sym => query)
|
|
63
|
+
end
|
|
64
|
+
define_method("find_by_#{index}!") do |query|
|
|
65
|
+
find_by!(index.to_sym => query)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
protected
|
|
70
|
+
|
|
71
|
+
def states
|
|
72
|
+
unless @states
|
|
73
|
+
indices = INDICES.inject({}) { |memo, index| memo.merge index => [] }
|
|
74
|
+
@states = data.map do |state_data|
|
|
75
|
+
new(state_data).tap { |state| build_indices(indices, state) }
|
|
76
|
+
end
|
|
77
|
+
INDICES.each { |index| class_variable_set(:"@@#{index}_index", indices[index]) } # rubocop:disable Style/ClassVars
|
|
78
|
+
end
|
|
79
|
+
@states
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def data
|
|
83
|
+
YAML.load_file(File.join(File.dirname(__FILE__), '..', 'data', 'states.yml'))
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def build_indices(indices, state)
|
|
87
|
+
INDICES.each { |index| indices[index] << state.send(index) }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
## define private methods for internal use of indexed array
|
|
91
|
+
INDICES.each do |index|
|
|
92
|
+
define_method("#{index}_index") do
|
|
93
|
+
states
|
|
94
|
+
class_variable_get(:"@@#{index}_index")
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
## return the index for query given to find_by/find_by! method
|
|
99
|
+
def get_key(data)
|
|
100
|
+
keys = data.keys
|
|
101
|
+
if keys.length != 1 || INDICES.none? { |key| key.to_sym == keys.first.to_sym }
|
|
102
|
+
raise ArgumentError, "`find_by` accepts only one of #{INDICES.join(' or ')} as argument. None provided"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
keys.first
|
|
106
|
+
end
|
|
107
|
+
end
|
|
106
108
|
end
|
|
107
|
-
|
|
109
|
+
|
|
110
|
+
class Nayyar::StateNotFound < StandardError; end
|
data/lib/nayyar/township.rb
CHANGED
|
@@ -1,119 +1,125 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Represents a Township in Myanmar
|
|
1
4
|
class Nayyar::Township
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
5
|
+
attr_reader :data
|
|
6
|
+
|
|
7
|
+
@townships = nil
|
|
8
|
+
@district_index = {}
|
|
9
|
+
|
|
10
|
+
ATTRIBUTES = %i[
|
|
11
|
+
pcode
|
|
12
|
+
name
|
|
13
|
+
].freeze
|
|
14
|
+
|
|
15
|
+
INDICES = %w[pcode].freeze
|
|
16
|
+
|
|
17
|
+
def initialize(data)
|
|
18
|
+
@data = data
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# define getters
|
|
22
|
+
ATTRIBUTES.each do |attr|
|
|
23
|
+
define_method attr do
|
|
24
|
+
@data[attr]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# allow the values to be retrieved as an array
|
|
29
|
+
def [](key)
|
|
30
|
+
if ATTRIBUTES.include? key
|
|
31
|
+
@data[key]
|
|
32
|
+
elsif key.to_sym == :district
|
|
33
|
+
district
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def district
|
|
38
|
+
Nayyar::District.find_by_pcode(@data[:district])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class << self
|
|
42
|
+
def all
|
|
43
|
+
townships
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def of_district(district)
|
|
47
|
+
state_pcode = district.pcode
|
|
48
|
+
townships = self.townships
|
|
49
|
+
@district_index[state_pcode].map do |index|
|
|
50
|
+
townships[index]
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def find_by(query)
|
|
55
|
+
key = get_key(query)
|
|
56
|
+
(index = send("#{key}_index".to_sym).index(query[key])) && townships[index]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def find_by!(query)
|
|
60
|
+
if (district = find_by(query))
|
|
61
|
+
district
|
|
62
|
+
else
|
|
63
|
+
key = get_key(query)
|
|
64
|
+
raise Nayyar::TownshipNotFound, "Cannot find State with given #{key}: #{query[key]}"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
INDICES.each do |index|
|
|
69
|
+
define_method("find_by_#{index}") do |query|
|
|
70
|
+
find_by(index.to_sym => query)
|
|
71
|
+
end
|
|
72
|
+
define_method("find_by_#{index}!") do |query|
|
|
73
|
+
find_by!(index.to_sym => query)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
protected
|
|
78
|
+
|
|
79
|
+
def townships
|
|
80
|
+
unless @townships
|
|
81
|
+
indices = INDICES.inject({}) { |memo, index| memo.merge index => [] }
|
|
82
|
+
@townships = data.each_with_index.map do |township_row, i|
|
|
83
|
+
new(township_row).tap { |township| build_indices(indices, township, township_row[:district], i) }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
INDICES.each do |index|
|
|
87
|
+
class_variable_set(:"@@#{index}_index", indices[index]) # rubocop:disable Style/ClassVars
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
@townships
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def data
|
|
94
|
+
YAML.load_file(File.join(File.dirname(__FILE__), '..', 'data', 'townships.yml'))
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def build_indices(indices, township, district_pcode, reference_index)
|
|
98
|
+
INDICES.each do |index|
|
|
99
|
+
indices[index] << township.send(index)
|
|
100
|
+
end
|
|
101
|
+
@district_index[district_pcode] ||= []
|
|
102
|
+
@district_index[district_pcode] << reference_index
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
## define private methods for internal use of indexed array
|
|
106
|
+
INDICES.each do |index|
|
|
107
|
+
define_method("#{index}_index") do
|
|
108
|
+
townships
|
|
109
|
+
class_variable_get("@@#{index}_index")
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
## return the index for query given to find_by/find_by! method
|
|
114
|
+
def get_key(data)
|
|
115
|
+
keys = data.keys
|
|
116
|
+
if keys.length != 1 || INDICES.none? { |key| key.to_sym == keys.first.to_sym }
|
|
117
|
+
raise ArgumentError, "`find_by` accepts only one of #{INDICES.join(' or ')} as argument. none provided"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
keys.first
|
|
121
|
+
end
|
|
122
|
+
end
|
|
118
123
|
end
|
|
119
|
-
|
|
124
|
+
|
|
125
|
+
class Nayyar::TownshipNotFound < StandardError; end
|
data/lib/nayyar/version.rb
CHANGED
data/lib/nayyar.rb
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
require "nayyar/state"
|
|
3
|
-
require "nayyar/district"
|
|
4
|
-
require "nayyar/township"
|
|
1
|
+
# frozen_string_literal: true
|
|
5
2
|
|
|
3
|
+
require 'yaml'
|
|
4
|
+
require 'nayyar/version'
|
|
5
|
+
require 'nayyar/state'
|
|
6
|
+
require 'nayyar/district'
|
|
7
|
+
require 'nayyar/township'
|
|
8
|
+
|
|
9
|
+
# Top-level module for Nayyar.
|
|
6
10
|
module Nayyar
|
|
7
|
-
end
|
|
11
|
+
end
|
data/nayyar.gemspec
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
5
|
require 'nayyar/version'
|
|
5
6
|
|
|
6
7
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
8
|
+
spec.name = 'nayyar'
|
|
8
9
|
spec.version = Nayyar::VERSION
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.email = [
|
|
10
|
+
spec.authors = ['mmhan']
|
|
11
|
+
spec.email = ['mmhan2u@gmail.com']
|
|
12
|
+
spec.required_ruby_version = '>= 2.7.0'
|
|
11
13
|
|
|
12
|
-
spec.summary =
|
|
13
|
-
spec.description =
|
|
14
|
+
spec.summary = 'Nayyar gives you access to State/Regions, Districts and Townships of Myanmar.'
|
|
15
|
+
spec.description = "Nayyar is created with the intent of providing basic access to State/Regions, Districts or
|
|
16
|
+
Townships of Myanmar, based on standards of Myanmar's country-wide census of 2014.
|
|
14
17
|
|
|
15
18
|
15 States are indexed by MIMU's pcode, ISO3166-2:MM and alpha3 codes used in plate numbers by transportation authority.
|
|
16
19
|
74 Districts and 413 Townships are indexed by MIMU's pcode.
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
spec.homepage =
|
|
20
|
-
spec.license =
|
|
21
|
+
Uses [Semantic Versioning](http://semver.org/)"
|
|
22
|
+
spec.homepage = 'https://github.com/mmhan/nayyar'
|
|
23
|
+
spec.license = 'MIT'
|
|
21
24
|
|
|
22
25
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
|
23
26
|
# delete this section to allow pushing this gem to any host.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
27
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
|
|
28
|
+
|
|
29
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
30
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
29
31
|
|
|
30
32
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
31
|
-
spec.bindir =
|
|
33
|
+
spec.bindir = 'exe'
|
|
32
34
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
33
|
-
spec.require_paths = [
|
|
35
|
+
spec.require_paths = ['lib']
|
|
34
36
|
|
|
35
|
-
spec.add_development_dependency
|
|
36
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
|
37
|
-
spec.add_development_dependency 'rspec', '>= 3'
|
|
37
|
+
spec.add_development_dependency 'bundler', '>= 2.3.10'
|
|
38
38
|
spec.add_development_dependency 'pry', '>= 0.10'
|
|
39
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
|
40
|
+
spec.add_development_dependency 'rspec', '>= 3'
|
|
41
|
+
spec.add_development_dependency 'rubocop', '~> 1.27.0'
|
|
42
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
|
|
39
43
|
end
|
metadata
CHANGED
|
@@ -1,43 +1,57 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nayyar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- mmhan
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-04-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 2.3.10
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 2.3.10
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: pry
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0.10'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0.10'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: rake
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
30
44
|
requirements:
|
|
31
|
-
- - "
|
|
45
|
+
- - ">="
|
|
32
46
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
47
|
+
version: 12.3.3
|
|
34
48
|
type: :development
|
|
35
49
|
prerelease: false
|
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
51
|
requirements:
|
|
38
|
-
- - "
|
|
52
|
+
- - ">="
|
|
39
53
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
54
|
+
version: 12.3.3
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: rspec
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -53,34 +67,51 @@ dependencies:
|
|
|
53
67
|
- !ruby/object:Gem::Version
|
|
54
68
|
version: '3'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
70
|
+
name: rubocop
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
58
72
|
requirements:
|
|
59
|
-
- - "
|
|
73
|
+
- - "~>"
|
|
60
74
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
75
|
+
version: 1.27.0
|
|
62
76
|
type: :development
|
|
63
77
|
prerelease: false
|
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
79
|
requirements:
|
|
66
|
-
- - "
|
|
80
|
+
- - "~>"
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
|
-
version:
|
|
82
|
+
version: 1.27.0
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rubocop-rspec
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 2.9.0
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 2.9.0
|
|
69
97
|
description: |-
|
|
70
|
-
Nayyar is created with the intent of providing basic access to State/Regions, Districts or
|
|
98
|
+
Nayyar is created with the intent of providing basic access to State/Regions, Districts or
|
|
99
|
+
Townships of Myanmar, based on standards of Myanmar's country-wide census of 2014.
|
|
71
100
|
|
|
72
101
|
15 States are indexed by MIMU's pcode, ISO3166-2:MM and alpha3 codes used in plate numbers by transportation authority.
|
|
73
102
|
74 Districts and 413 Townships are indexed by MIMU's pcode.
|
|
74
103
|
|
|
75
|
-
|
|
104
|
+
Uses [Semantic Versioning](http://semver.org/)
|
|
76
105
|
email:
|
|
77
106
|
- mmhan2u@gmail.com
|
|
78
107
|
executables: []
|
|
79
108
|
extensions: []
|
|
80
109
|
extra_rdoc_files: []
|
|
81
110
|
files:
|
|
111
|
+
- ".circleci/config.yml"
|
|
82
112
|
- ".gitignore"
|
|
83
113
|
- ".rspec"
|
|
114
|
+
- ".rubocop.yml"
|
|
84
115
|
- ".travis.yml"
|
|
85
116
|
- Gemfile
|
|
86
117
|
- LICENSE.txt
|
|
@@ -105,7 +136,8 @@ licenses:
|
|
|
105
136
|
- MIT
|
|
106
137
|
metadata:
|
|
107
138
|
allowed_push_host: https://rubygems.org
|
|
108
|
-
|
|
139
|
+
rubygems_mfa_required: 'true'
|
|
140
|
+
post_install_message:
|
|
109
141
|
rdoc_options: []
|
|
110
142
|
require_paths:
|
|
111
143
|
- lib
|
|
@@ -113,16 +145,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
113
145
|
requirements:
|
|
114
146
|
- - ">="
|
|
115
147
|
- !ruby/object:Gem::Version
|
|
116
|
-
version:
|
|
148
|
+
version: 2.7.0
|
|
117
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
150
|
requirements:
|
|
119
151
|
- - ">="
|
|
120
152
|
- !ruby/object:Gem::Version
|
|
121
153
|
version: '0'
|
|
122
154
|
requirements: []
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
signing_key:
|
|
155
|
+
rubygems_version: 3.3.11
|
|
156
|
+
signing_key:
|
|
126
157
|
specification_version: 4
|
|
127
158
|
summary: Nayyar gives you access to State/Regions, Districts and Townships of Myanmar.
|
|
128
159
|
test_files: []
|