rwanda 0.6.0 → 0.7.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -0
- data/lib/rwanda/version.rb +1 -1
- data/lib/rwanda.rb +6 -1
- data/rwanda.gemspec +2 -0
- data/spec/rwanda_spec.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de04553007e96f17ba5c64c47121ec6f1ba9f70d
|
4
|
+
data.tar.gz: 10bff714e5cd301c7321add3af0f28e34097f713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6eb6509e493a026f1b98b978ea599eafd2440d2b7b1d76b861f244468a7e33e55d13643ddce21d3a7b04af86771c40547ee2589e69d52d248e432e3b9bc3db8
|
7
|
+
data.tar.gz: 97fee3c176396e3ec7fcf3a3f7de1b85012c3ad634cac34ce7354d18ffc18bb8d50a36e381d6cfa65513e1bb4d401f855954d391b7e7a3d56f1ecb5a0a661a09
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/rwanda/version.rb
CHANGED
data/lib/rwanda.rb
CHANGED
@@ -113,7 +113,7 @@ class Rwanda
|
|
113
113
|
end
|
114
114
|
def exist?(district=false, sector=false, cell=false, village=false)
|
115
115
|
villages = @villages.dup
|
116
|
-
return
|
116
|
+
return false unless district
|
117
117
|
{district: district, sector: sector, cell: cell, village: village}.each_pair do |division_name,division|
|
118
118
|
#binding.pry
|
119
119
|
return true unless division
|
@@ -123,6 +123,11 @@ class Rwanda
|
|
123
123
|
true
|
124
124
|
end
|
125
125
|
def exists?(*p); exist?(*p); end
|
126
|
+
def valid?(*p)
|
127
|
+
# Is this location either (a) real, or (b) nil (both of which are valid if an object's address can be null)
|
128
|
+
return true if p.reject{|i| i.nil?}.empty? # all nils is fine
|
129
|
+
exist? *p
|
130
|
+
end
|
126
131
|
|
127
132
|
# )) Translation ((
|
128
133
|
def translate(province)
|
data/rwanda.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = '>= 1.9.3'
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
25
|
spec.add_development_dependency "rspec"
|
data/spec/rwanda_spec.rb
CHANGED
@@ -138,6 +138,7 @@ describe Rwanda do
|
|
138
138
|
|
139
139
|
expect(r.exist?('karongi','bwishyura','kiniha','nyarurembo')).to eq true
|
140
140
|
expect(r.exist?('karongi','bwishyura','nyarurembo')).to eq false
|
141
|
+
expect(r.exist?(nil,nil,'',nil)).to eq false
|
141
142
|
expect(r.exist?('karongi')).to eq true
|
142
143
|
|
143
144
|
# .exists? is an acceptable synonym
|
@@ -146,6 +147,16 @@ describe Rwanda do
|
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
150
|
+
describe '.valid?' do
|
151
|
+
it 'knows whether a chain of divisions is valid, which an empty set is' do
|
152
|
+
expect(r.valid?('Karongi','Bwishyura','Kiniha','Nyarurembo')).to eq true
|
153
|
+
expect(r.valid?(nil,nil,nil)).to eq true
|
154
|
+
|
155
|
+
expect(r.valid?('Karongi','Bwishyura','Nyarurembo')).to eq false
|
156
|
+
expect(r.valid?(nil,nil,'',nil)).to eq false
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
149
160
|
describe '.translate' do
|
150
161
|
it 'can translate a province from English to Kinyarwanda' do
|
151
162
|
expect(r.translate('Northern Province')).to eq 'Amajyaruguru'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rwanda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Hetherington
|
@@ -117,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
117
|
requirements:
|
118
118
|
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
120
|
+
version: 1.9.3
|
121
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - ">="
|