uk_postcode 2.1.3 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68a30ca2d945ea3f8c66d44cec230e9dcc5c8086bab7afd61075e7b41e394705
4
- data.tar.gz: 611872c6d9e9e2eac42f08028d45f141fb55bcf88337f65334eea311b64dea6f
3
+ metadata.gz: 663b870a601ea6e50e4e29cf1f82f6d0888cc5e3fa4bf7a6bb572299769021ef
4
+ data.tar.gz: 7795a517f4c3b3d9410c8df9c8f5494097668a2000c9bf3dac293855082fbec7
5
5
  SHA512:
6
- metadata.gz: 94dcdc458f4f53c2f6ba43e9a15e6a314a507925fb3e571d551eb153384f05991a28866325ebb9a2e7ff33566ba066aa943e1eee7ccbc2dd061640aa29470727
7
- data.tar.gz: e7443d0e0cc523545b4a10b7c2301e24d64afec96329736b7cce963b7cfcb7018d6819c966a178f60f57ebaa92b111fb2b7e4d1993cdf13804105b5791c0e1ce
6
+ metadata.gz: e5b4e63111a8d586282fb74a304f4c33e6181de1ea8ebf1d93e8094a5f4af121de85f01b53eb8289dfe818089ecc7b4ed958e8273f045eb1f82f9ed73625f572
7
+ data.tar.gz: 87418d80cc33a4d3431f9f6afc817bbcea8be6389ff78a1fd070e71fa4ffd07d01d22acebf6860f6ff97d0c3d3bfe3b35ed41ee5f86055cd2b6006432c9071a7
data/CHANGES CHANGED
@@ -1,3 +1,15 @@
1
+ 2.1.6 (2020-08-26)
2
+
3
+ * Updated country lookup using latest ONS Postcode Database (May 2020).
4
+
5
+ 2.1.5 (2019-10-08)
6
+
7
+ * Updated country lookup using latest ONS Postcode Database (Oct 2019).
8
+
9
+ 2.1.4 (2019-05-31)
10
+
11
+ * Updated country lookup using latest ONS Postcode Database (May 2019).
12
+
1
13
  2.1.3 (2018-10-03)
2
14
 
3
15
  * Updated country lookup using latest ONS Postcode Database (Aug 2018).
data/README.md CHANGED
@@ -168,18 +168,14 @@ gem "uk_postcode", "~> 2.1.0"
168
168
  To run the test suite:
169
169
 
170
170
  ```sh
171
- $ make
171
+ $ rake
172
172
  ```
173
173
 
174
174
  The full list of UK postcodes is not included in the repository due to its
175
175
  size, but will be fetched automatically from [mySociety][mys].
176
176
 
177
177
  If you are running an automatic build process, please find a way to cache these
178
- files and run the tests via Rake instead:
179
-
180
- ```
181
- $ rake
182
- ```
178
+ files between runs.
183
179
 
184
180
  ## Occasionally asked questions
185
181
 
@@ -1,8 +1,8 @@
1
1
  module UKPostcode
2
2
  COUNTRY_LOOKUP = {
3
- england: /^(?:AL|B[123456789ABDHLNRS]|C(?:A(?:1|2|3|4|5|6(?:4|5(?:G|H[TU]|L[GHJLNPQRSTUWXYZ]|N|P|Q|R|S|T|U|W|X|Y)|6|7)|7|8|9)|B|H(?:1(?:1|2|3|4(?:A|B|D|E|F|G|H|J|L|N|P|Q[ABDFGHJNPQRSTUWX]|R|S|W|X|Y|Z)|5|6(?:A|B[DEFGHJUW]|D[ABEFGHLNPQRSTUWXYZ]|E[ADEFGHJLNPQRSTUWXYZ]|F|G|H[DEFGJLNQSTUWXYZ]|J|L|N|P|Q[ADHJLPR]|R|W|X|Y|Z)|9)|2(?:1|2|3|4|5|6|7|89(?:A[ABEFGHJLNPQRSTUWXYZ]|B)|99(?:A[BDEFGHJLNPQRSTUWXYZ]|B|D|E|F))|3(?:5|6|7|8|9|0|1|2|3|49(?:A[ABDEFGHJLNQRSTUWXYZ]|B|D|E|S|T|U|Z))|4(?:0(?:EJ|W[BDFGHRU]|Y[HJ]|Z[ADEFGHJLPTUWY])|7|8(?:A|B[ABDEGHJLNPQRSUWXYZ]|D|E|H|J|L[BDEFLNPSUXYZ]|N[DEFGLNPQRSTUWXYZ]|P[ADEFGHJLNPQRSTUWXZ]|Q[ADUX]|R[AD]|W[ABDEFGHJLPQRSTUWXYZ]|X|Y|Z|0|1|2|3|4|5|6|7|8|9)|9(?:A[DEFG]|BW|D[EFGHJLNPQRSTUW]|E[BDEFGJLNPQRS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|W[BDEFG])|7(?:J[EFGHJLNQW]|N[EFSTUXYZ]|P[AGSTUXYZ]|Q)|9(?:B[PW]|F[NP]|HZ|J[GHJLNPRSTUWXYZ]|L[ABDEFGHJLNPQRTW]|PA))|56(?:A[ABDEFGHJLNPQRSTUWZ]|B[AB]|D[HJLNQSTUWXYZ]|E[ABFGHJLNQRSTUWXYZ]|F|H[ABDEFGHJLNPQRSWXZ]|J|L|N|P|Q|R|S[ABDEFGHQRSTUX]|T[ABDEFGHJLNPQWY]|U[AJLNPR]|W|Y)|6|7|8)|2(?:2(?:5(?:A|B|D|E|H|J|L|N|W[ABPZ])|6(?:A|B|D|E[NPRSTUWXYZ]|F|G|H[AEFLNPRSTUWXYZ]|J[ABDEFGHJLNPQRSTWYZ]|L[ABDEFHJPRST]|N[ABDEFGHJLNPQRSTUXYZ]|P|Q[ABDEFGHJLNPQRSTUWXZ]|R|S|T|U|W[ADFG]|X|Y))|56|0|1(?:0|1|7|8(?:A|B|D[ABDEFGHJPQRSTUWXYZ]|E[ABDEFGHJLNQSTUXYZ]|F[ABDJ]|G|H|J[ABDEFGHJZ]|L|N|P|Q|R|S|T|W|X|Z)|9)|3|4)|5(?:0J[JLN]|9(?:A[RSTUWXYZ]|B[ABDEFGHJLNPQSTUW]|EU|FB|GN|LD|SB))|78PS|95J[PW])))/,
6
6
  channel_islands: /^(?:GY|J)/,
7
7
  isle_of_man: /^IM/,
8
8
  northern_ireland: /^BT/
@@ -65,7 +65,7 @@ module UKPostcode
65
65
  # Returns true if the postcode is a valid full postcode (e.g. W1A 1AA)
66
66
  #
67
67
  def full?
68
- area && district && sector && unit && true
68
+ [area, district, sector, unit].all?
69
69
  end
70
70
 
71
71
  # Any geographic postcode is assumed to be valid
@@ -1,3 +1,3 @@
1
1
  module UKPostcode
2
- VERSION = "2.1.3"
2
+ VERSION = "2.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uk_postcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Battley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-03 00:00:00.000000000 Z
11
+ date: 2021-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '13'
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: '0'
26
+ version: '13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -69,15 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 1.9.2
72
+ version: '2.6'
73
73
  required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubyforge_project:
80
- rubygems_version: 2.7.7
79
+ rubygems_version: 3.2.22
81
80
  signing_key:
82
81
  specification_version: 4
83
82
  summary: UK postcode parsing and validation