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.
@@ -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
  #
@@ -27,7 +27,7 @@ TW:
27
27
  lng: 116.6665
28
28
  international_prefix: "002"
29
29
  ioc: TPE
30
- iso_long_name: The Republic of China
30
+ iso_long_name: Taiwan, Province of China
31
31
  iso_short_name: Taiwan, Province of China
32
32
  languages_official:
33
33
  - zh
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Countries
4
- VERSION = '5.5.0'
4
+ VERSION = '5.6.0'
5
5
  end
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.5.0
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-06-17 00:00:00.000000000 Z
14
+ date: 2023-08-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: unaccent