paf 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/paf/lineable.rb +1 -2
- data/lib/paf/thoroughfare_locality.rb +10 -10
- data/lib/paf/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7138b6a5f3acbe97f7f227410d48f972310a7d1a
|
4
|
+
data.tar.gz: ce12de78a4ca2e7f7556375de50fbc9cf143a982
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddc67a2e7ea3e1e5493a45d37e5b80473532f3d33bd8c2a733e4bf0a6529e88caa532c8ac44f10dad0ca2dd9036f52ab12d330a0f05f686ce2407e4b5bc6db3b
|
7
|
+
data.tar.gz: 7d5b94a394240e8406eb53e947cb5fb010ee9cf4a3123d1d392b5f775c25338df46b71f98e827764fbb0590c5b7e97c70a0f905312d06cb60969c2f617ae397b
|
data/lib/paf/lineable.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
class Paf
|
2
2
|
# Processing for thoroughfare and locality elements of a PAF entry
|
3
3
|
module ThoroughfareLocality
|
4
|
-
def thoroughfare_and_locality_attrs
|
5
|
-
%i[dependent_thoroughfare thoroughfare] + self.class.locality_attrs
|
6
|
-
end
|
7
|
-
|
8
4
|
def thoroughfares_and_localities
|
9
5
|
[].tap do |array|
|
10
6
|
thoroughfare_and_locality_attrs.each do |attr|
|
11
|
-
|
12
|
-
value = send(attr)
|
13
|
-
array << value unless value.vacant?
|
7
|
+
array << send(attr) unless used_or_vacant?(attr)
|
14
8
|
end
|
15
9
|
end
|
16
10
|
end
|
17
11
|
|
18
12
|
private
|
19
13
|
|
14
|
+
def thoroughfare_and_locality_attrs
|
15
|
+
%i[dependent_thoroughfare thoroughfare] + self.class.locality_attrs
|
16
|
+
end
|
17
|
+
|
20
18
|
def first_thoroughfare_or_locality
|
21
19
|
send(first_thoroughfare_or_locality_attr) unless
|
22
20
|
first_thoroughfare_or_locality_attr.nil?
|
23
21
|
end
|
24
22
|
|
25
23
|
def first_thoroughfare_or_locality_attr
|
26
|
-
thoroughfare_and_locality_attrs.find
|
27
|
-
!send(attr).vacant?
|
28
|
-
end
|
24
|
+
thoroughfare_and_locality_attrs.find { |attr| !send(attr).vacant? }
|
29
25
|
end
|
30
26
|
|
31
27
|
def used?(attr)
|
32
28
|
premises_includes_first_thoroughfare_or_locality? &&
|
33
29
|
(attr == first_thoroughfare_or_locality_attr)
|
34
30
|
end
|
31
|
+
|
32
|
+
def used_or_vacant?(attr)
|
33
|
+
used?(attr) || send(attr).vacant?
|
34
|
+
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/paf/version.rb
CHANGED