paf 0.6.0 → 1.0.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/lib/paf/core_ext/string.rb +26 -2
- data/lib/paf/premises/common.rb +4 -0
- data/lib/paf/premises/rule010.rb +0 -4
- data/lib/paf/premises/rule100.rb +22 -0
- data/lib/paf/premises/rule110.rb +12 -3
- data/lib/paf/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 269cc685e003a0106f7a804214b07e9b092b0eaa5a83819683c7e7fe84262860
|
4
|
+
data.tar.gz: b07e3c71d8f2563c463ebc884a9519c45113227d377851b7971932b9007263b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67dc68a5c3f48cfbfb276d86dbbf9bcb9aa1e9cbee76a38fb2fae3c1807060ec8866daecad2ea8aca1182db343c85debe3cd74a1865013e15034b2b67485b1a1
|
7
|
+
data.tar.gz: e96a0558f766afd92fcd8a09110ca83ac4783c2293c3a05585a92d4f7e3002503f153cf3d69eb00cc0af14a16b3900b1d843aa5f2ff76a221b098b2b96cc74ac
|
data/lib/paf/core_ext/string.rb
CHANGED
@@ -2,12 +2,31 @@ module Paf
|
|
2
2
|
module CoreExt
|
3
3
|
# Extend the core String class with PAF specific processing
|
4
4
|
module String
|
5
|
+
def exception_i?
|
6
|
+
!/\A\d.*\d\z/.match(self).nil?
|
7
|
+
end
|
8
|
+
|
9
|
+
def exception_ii?
|
10
|
+
!/\A\d[A-Za-z]\z|\A\d.*\d[A-Za-z]\z/.match(self).nil?
|
11
|
+
end
|
12
|
+
|
13
|
+
def exception_iii?
|
14
|
+
!/\A\S\z/.match(self).nil?
|
15
|
+
end
|
16
|
+
|
5
17
|
def exception?
|
6
18
|
!/^(.|[\d][[:alpha:]]|[\d].*?[\d][[:alpha:]]?)$/.match(self).nil?
|
7
19
|
end
|
8
20
|
|
9
21
|
def split_exception?
|
10
|
-
last_word.
|
22
|
+
(last_word.exception_i? || last_word.exception_ii?) &&
|
23
|
+
/^\d+$/.match(last_word).nil? &&
|
24
|
+
!but_last_word.known_building_type? &&
|
25
|
+
!penultimate_word.known_split_building_type?
|
26
|
+
end
|
27
|
+
|
28
|
+
def penultimate_word
|
29
|
+
but_last_word.last_word
|
11
30
|
end
|
12
31
|
|
13
32
|
def last_word
|
@@ -21,9 +40,14 @@ module Paf
|
|
21
40
|
def known_building_type?
|
22
41
|
[
|
23
42
|
'BACK OF', 'BLOCK', 'BLOCKS', 'BUILDING', 'MAISONETTE', 'MAISONETTES', 'REAR OF',
|
24
|
-
'SHOP', 'SHOPS', 'STALL', 'STALLS', 'SUITE', 'SUITES', 'UNIT', 'UNITS'
|
43
|
+
'SHOP', 'SHOPS', 'STALL', 'STALLS', 'SUITE', 'SUITES', 'UNIT', 'UNITS',
|
44
|
+
'FLAT', 'FLATS', 'PO BOX'
|
25
45
|
].include?(self)
|
26
46
|
end
|
47
|
+
|
48
|
+
def known_split_building_type?
|
49
|
+
['UNIT'].include?(self)
|
50
|
+
end
|
27
51
|
end
|
28
52
|
end
|
29
53
|
end
|
data/lib/paf/premises/common.rb
CHANGED
@@ -19,6 +19,10 @@ module Paf
|
|
19
19
|
def name_and_thoroughfare_or_locality
|
20
20
|
"#{building_name} #{first_thoroughfare_or_locality}"
|
21
21
|
end
|
22
|
+
|
23
|
+
def name_last_word_and_thoroughfare_or_locality
|
24
|
+
"#{building_name.last_word} #{first_thoroughfare_or_locality}"
|
25
|
+
end
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
data/lib/paf/premises/rule010.rb
CHANGED
@@ -19,10 +19,6 @@ module Paf
|
|
19
19
|
def premises_includes_first_thoroughfare_or_locality?
|
20
20
|
building_name.exception? || building_name.split_exception?
|
21
21
|
end
|
22
|
-
|
23
|
-
def name_last_word_and_thoroughfare_or_locality
|
24
|
-
"#{building_name.last_word} #{first_thoroughfare_or_locality}"
|
25
|
-
end
|
26
22
|
end
|
27
23
|
end
|
28
24
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Paf
|
2
|
+
module Premises
|
3
|
+
# Processing for premises elements of a PAF entry under Rule X
|
4
|
+
module Rule100
|
5
|
+
def premises
|
6
|
+
return [sub_name_and_thoroughfare_or_locality] if sub_building_name.exception?
|
7
|
+
|
8
|
+
[sub_building_name]
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def premises_includes_first_thoroughfare_or_locality?
|
14
|
+
sub_building_name.exception?
|
15
|
+
end
|
16
|
+
|
17
|
+
def sub_name_and_thoroughfare_or_locality
|
18
|
+
"#{sub_building_name} #{first_thoroughfare_or_locality}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/paf/premises/rule110.rb
CHANGED
@@ -3,9 +3,14 @@ module Paf
|
|
3
3
|
# Processing for premises elements of a PAF entry under Rule 6
|
4
4
|
module Rule110
|
5
5
|
def premises
|
6
|
+
if sub_building_name.exception? && building_name.split_exception?
|
7
|
+
return [sub_and_building_name_but_last_word, name_last_word_and_thoroughfare_or_locality]
|
8
|
+
end
|
6
9
|
return [sub_name_and_name] if sub_building_name.exception?
|
7
|
-
return [sub_building_name, name_and_thoroughfare_or_locality] if
|
8
|
-
|
10
|
+
return [sub_building_name, name_and_thoroughfare_or_locality] if building_name.exception?
|
11
|
+
if building_name.split_exception?
|
12
|
+
return [sub_building_name, building_name.but_last_word, name_last_word_and_thoroughfare_or_locality]
|
13
|
+
end
|
9
14
|
|
10
15
|
[sub_building_name, building_name]
|
11
16
|
end
|
@@ -13,7 +18,11 @@ module Paf
|
|
13
18
|
private
|
14
19
|
|
15
20
|
def premises_includes_first_thoroughfare_or_locality?
|
16
|
-
!sub_building_name.exception? && building_name.exception?
|
21
|
+
building_name.split_exception? || (!sub_building_name.exception? && building_name.exception?)
|
22
|
+
end
|
23
|
+
|
24
|
+
def sub_and_building_name_but_last_word
|
25
|
+
"#{sub_building_name} #{building_name.but_last_word}"
|
17
26
|
end
|
18
27
|
end
|
19
28
|
end
|
data/lib/paf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/paf/premises/rule001.rb
|
120
120
|
- lib/paf/premises/rule010.rb
|
121
121
|
- lib/paf/premises/rule011.rb
|
122
|
+
- lib/paf/premises/rule100.rb
|
122
123
|
- lib/paf/premises/rule101.rb
|
123
124
|
- lib/paf/premises/rule110.rb
|
124
125
|
- lib/paf/premises/rule111.rb
|