countries 5.5.0 → 5.6.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/.github/workflows/codeql-analysis.yml +3 -3
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/countries/cache/countries.json +1 -1
- data/lib/countries/country.rb +5 -3
- data/lib/countries/data/countries/TW.yaml +1 -1
- data/lib/countries/version.rb +1 -1
- data/spec/country_spec.rb +1 -0
- metadata +2 -2
data/lib/countries/country.rb
CHANGED
|
@@ -86,6 +86,11 @@ module ISO3166
|
|
|
86
86
|
data['euvat_member'].nil? ? in_eu? : data['euvat_member']
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
+
# @return [String] The regex for valid postal codes in this Country
|
|
90
|
+
def postal_code_format
|
|
91
|
+
"\\A#{data['postal_code_format']}\\Z" if postal_code
|
|
92
|
+
end
|
|
93
|
+
|
|
89
94
|
def to_s
|
|
90
95
|
data['iso_short_name']
|
|
91
96
|
end
|
|
@@ -180,9 +185,6 @@ module ISO3166
|
|
|
180
185
|
# @!attribute postal_code
|
|
181
186
|
# @return [Boolean] Does this Country uses postal codes in addresses
|
|
182
187
|
#
|
|
183
|
-
# @!attribute postal_code_format
|
|
184
|
-
# @return [String] The regex for valid postal codes in this Country
|
|
185
|
-
#
|
|
186
188
|
# @!attribute region
|
|
187
189
|
# @return [String] The Region this country is in. Approximately matches the United Nations geoscheme
|
|
188
190
|
#
|
data/lib/countries/version.rb
CHANGED
data/spec/country_spec.rb
CHANGED
|
@@ -94,6 +94,7 @@ describe ISO3166::Country do
|
|
|
94
94
|
|
|
95
95
|
regex = Regexp.new(country.postal_code_format)
|
|
96
96
|
expect(regex).to match('12345-6789')
|
|
97
|
+
expect(regex).not_to match('12345-67890')
|
|
97
98
|
|
|
98
99
|
antarctica = ISO3166::Country.search('AQ')
|
|
99
100
|
expect(antarctica.postal_code_format).to be_nil
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: countries
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josh Robinson
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2023-
|
|
14
|
+
date: 2023-08-01 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: unaccent
|